POC service for API testing
yarn
yarn start
The following environment variables can be used to configure the service:
DISABLE_CRON to disable request processing CRON (default: false)DEBUG_DB to enabled DB debugging (default: false)PORT to set on which port the service should run (default: 3000)MAX_FACTORY to set the maximum number of factories (ID) (default: 20000)PROCESS_INTERVAL to set interval of request processing CRON (default: 5000 (ms))yarn start:debug
Debug mode is different than the normal mode in:
| Method | URL | Description | Response |
|---|---|---|---|
GET |
/lambda?factoryId |
Requests a new serial ID for the factory | { token: "uuid" } |
GET |
/service?requestToken |
Retrieves status of the request | { status: "pending,provisioned,failed,timeout", id: "<if-provisioned-or-timedout>", "error": "<if-failed>" } |
| Method | URL | Description | Response |
|---|---|---|---|
GET |
/process |
Trigger request processing | {} |
GET |
/clean |
Clean database | {} |
GET |
/factory?factoryId |
Returns the factory data | { id: "1", last: "<last-sequence-n>", serials: ["<provisioned-sequence-ids>", ...], serialGaps: ["<gap-sequence-ids>"] } |
GET |
/requests |
Returns all requests | { requests: [ { factoryId: 123, status: "pending,provisioned,failed,timeout", token: "uuid", created: <ts>, _toBeFailed: false, _toBeGap: false }, ...]} |
The /lambda accepts two parameters to handle negative and edge cases:
?toBeGap - indicates that the generated serial ID should be considered as a gap and provisioned later?toBeFailed - indicates that the request processing should fail with Unknown error.To build the image:
docker build -t lm-poc:latest .
docker run -d -p 3000:3000 lm-poc:latest
docker run -d -p 3000:3000 -e DISABLE_CRON=1 -e DEBUG_DB=1 lm-poc:latest
For detailed documentation see the TypeDocs documentation.
Generated using TypeDoc