A quick and dirty health check http micro-server with zero-dependencies for node apps.
npm i --save yougood
const { ready, notReady, alive, dead, server } = require('yougood');
server.listen(3000);
// signal app is alive
alive()
// finished doing prep work, eg. connect to db
// signal app is ready
ready();
// some problem occures
// e.g. db error listener
notReady('db connection went just went down'. Date.now());
The following paths are set by default if none are provided. Any other path will return status code 400.
Used to check if app is alive. Returns 200 Ok if things are good, 500 otherwise.
Used to check if app is ready. Returns 200 Ok if things are good, 500 otherwise.
Call this function to set ready state to true.
Call this function to set ready state to false. You can also pass an optional message which will be returned in the body.
Call this function to set liveliness state to true. This signifies your application is ready.
Call this function to set liveliness state to false. This signifies your application is not ready yet. An optional message can be passed which will be returned in the body.