npm install healthkitHealth check utility library





```
npm install --save healthkit
Checks for signal file and if it exists responds with 404 code200
(to signal to load balancer to drain incoming requests),
if signal file doesn't exist, checks for upstream endpoint,
and returns if endpoint is reachable and responds with successful http response.500
Otherwise returns code when all previous checks fail.
`javascript
var healthkit = require('healthkit');
var myAppChecks = [
// first check for lets-drain signal file
{
status: 404, // respond with 404 if file present
file: '/etc/consul/test_file.exists'
},
// second check for underlying endpoint
// proceeded here if previous check failed
{
status: 200, // respond with 200 if endpoint responds with successful code (200-299)
http: 'http://simple.url/endpoint'
},
// third (empty, default) check
// proceeded here if previous check failed
{
status: 500 // everything failed, fail the health check
}
];
// Express handler
app.get('/health', function(req, res)
{
healthkit(myAppChecks, function(code, result)
{
res.status(code).send(result);
});
});
``
More examples can be found in test folder.
Or open an issue with questions and/or suggestions.
HealthKit is released under the MIT license.