Members
(constant) HTTP_FAILED :integer
Type:
- integer
(constant) HTTP_HEALTHY :integer
Type:
- integer
Methods
executeCustomChecks(req, res, checks) → {boolean}
executeCustomChecks - description
Parameters:
Name | Type | Description |
---|---|---|
req |
object | request object |
res |
object | response object |
checks |
array | array of functions to execute to check service health. functions must return boolean |
Returns:
Returns true if checks is falsy otherwise returns false if any check fails
- Type
- boolean
healthCheck(req, res, checks) → {boolean}
healthCheck - health check function to be used in middleware
Parameters:
Name | Type | Description |
---|---|---|
req |
object | request object |
res |
object | response object |
checks |
array | array of functions to execute health check |
Returns:
result of checks
- Type
- boolean
init(checks, cb) → {object}
init - intialize an express server for running a default `/health` endpoint
Parameters:
Name | Type | Description |
---|---|---|
checks |
array | optional array of functions to execute to check service health. functions must return boolean |
cb |
type | optional callback to execute once the server is started |
Returns:
returns the express server that was initialized
- Type
- object
middleware(checks) → {function}
middleware - express middleware for executing custom health checks
Parameters:
Name | Type | Description |
---|---|---|
checks |
array | optional array of functions to execute to check service health. functions must return boolean |
Returns:
middleware function
- Type
- function