Skip to main content

Configuring App Apis

Archibald comes with default two kinds of configurations DefaultAppApiConfig and DefaultApiConfig. The former consists additional params useMiddleware and doesn't have rejectUnauthorized.

Example configs

Use proxy and current origin

Example config for using current origin on the client and using NodeJS as proxy during SSR requests

const config = {
api: {
protcol: null,
host: null,
port: null,
base: '/jsapi',
useMiddleware: true
}
};
Request on client

/jsapi/v2/messages

Request on server during SSR

http://0.0.0.0:3100/jsapi/v2/messages

Use proxy and custom endpoint

Example config for using current origin on the client and using NodeJS as proxy during SSR requests

const config = {
api: {
protcol: 'https',
host: 'netconomy-b2c',
port: '3200',
base: '/rest',
useMiddleware: true
}
};
Request on client

https://netconomy.net:3200/rest/v2/messages

Request on server during SSR

http://0.0.0.0:3100/rest/v2/messages

Use no proxy and custom endpoint

Example config for using current origin on the client and using NodeJS as proxy during SSR requests

const config = {
api: {
protcol: 'https',
host: 'netconomy-b2c',
port: '3200',
base: '/occ',
useMiddleware: false
}
};
Request on client

https://netconomy.net:3200/occ/v2/messages

Request on server during SSR

https://netconomy.net:3200/occ/v2/messages

Generals

  • If you provide default ports (80 or 443) they are omitted from the url.
  • If useMiddleware=false the config is taken from app.api.
  • The server protocol is determined by the ssl config of the nodejs if used.
  • The server host and port are either the current ones or the fallbacks from archibald.json