hapi-alive
Health route for your hapi.js server
Requirements
- Node 8+
- Hapi 17+
Usage
Install from NPM
npm install --save hapi-alive
Options
The defaults are as described below. You can override any defaults by passing them in as options.
const defaults = path: '/health' tags: 'health' 'monitor' responses: healthy: message: 'I\'m healthy!!!' unhealthy: statusCode: 400 { return await true; } auth: false;
Example
var Hapi = ; { const server = Hapi; // Register alive plugin await server; await serverstart; console;}
Calling the health route
The health route is exposed using GET
method in a given path (/health
by default).
When the server is healthy the response status code should be 200.
When the health check returns error the status code should be 400 and the payload should contain the error title.
Change Log
- v2.0.0 (Nov. 30th, 2017) Upgrade to Hapi 17
- Hapi.js 17 suite of tool upgraded to latest.
- healthCheck API converted to async/await pattern. Callback is no longer accepted.
- v1.2.0
- v1.1.0
- v1.0.0