express-nemo-route-health
Version:
A middleware for express to add a route that handles health route in an api.
31 lines (22 loc) • 1.25 kB
Markdown
A middleware for express to add a route that handles health route in an api.
If any subsystem has a status of Failure it will respond with HTTP 424 - FAILED DEPENDENCY.
| Name | Required | Default value | Description |
| ---------------- | -------- | ------------- | --------------------------------------------------------------------------------------------------- |
| responseTemplate | | function | A function receiving the request and response object, returning a response to message to send back. |
| checks | yes | | An array of checks to perform when the health route is called |
| Name | Required | Default value | Description |
| ----- | -------- | ------------- | ----------------------------------------- |
| name | yes | | The name of the healthcheck |
| check | yes | | An async function returning OK or Failure |
```js
{
name: 'mongo-db',
check: async () => {
return 'OK'
}
}
```