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 |
{
name: 'mongo-db',
check: async () => {
return 'OK'
}
}