NodeJs SDK
Source code with detailed examples can be found here.
Installation
We have first-class TypeScript support, but this library can also be used in a javascript project. We provide a useful function to prevent errors in input config variables.
npm
yarn
Requirements
To start working with the backend application you should enter the required env variables:
Client id with basic auth grant type to work with aidbox:
AIDBOX_CLIENT_ID=
Client secret:
AIDBOX_CLIENT_SECRET=secret
Your aidbox url:
AIDBOX_URL=http://0.0.0.0:8085
Toggle debug mode:
APP_DEBUG=false
App name to identify the application in aidbox:
APP_ID=you-business-app
Secret for use application (aidbox will use it):
APP_SECRET=secret
Backend application url (aidbox will send a request to this base url):
APP_URL=http://0.0.0.0:8090
Port for your backend application:
APP_PORT=8090
App example
Typescript usage
Firstly, you should create a config object. By default, we use env variables but you can optionally enter process.env as an input parameter.
(optional) Add your specific context helpers
Next step is defining the manifest object. For example:
After you prepare the config object and define the manifest, you can run your backend application. Typescript won't let you miss any required config keys. There are additional check input parameters before the app is created:
Then you can go to your Aidbox. There you will find your new application in the Apps menu. To test the app, run this request in the Aidbox Rest Console:
Request
Response
Last updated