Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Starefossen/node-express-health

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@starefossen/express-health

Build status Codacy grade Codacy coverage NPM downloads NPM version Node version Dependency status

Health checking route for Express.js applications.

Install

$ npm install @starefossen/express-health --save

Usage

const healthCheck = require('@starefossen/express-health');

### Single Check

```js
app.get('/healthCheck', healthCheck({
  name: 'Database',
  check: cb => {
    // get status from database
    db.getStatus(cb);
  },
}));

Multiple Checks

app.get('/healthChecks', healthCheck([{
  name: 'MongoDB',
  check: cb => {
    // get status from MongoDB database
    mongo.db.stats(cb);
  },
},{
  name: 'Redis',
  check: cb => {
    // get status from Redis cache
    redis.info(cb);
  },
}]));