mongo-healthcheck

2.0.1 • Public • Published

mongo-healthcheck

NPM

Build Status

A simple function for checking if your mongoose connection to MongoDB is good.

Usage

var mongoHealthcheck = require('mongo-healthcheck'),
  mongoose = require('mongoose');
 
module.exports = function detailedHealthcheck(req, res) {
  var isError = false;
  var mongoResult;
  try {
    mongoResult = mongoHealthcheck(mongoose);
  } catch (err) {
    isError = true;
    mongoResult = err;
  }
  res.status(isError ? 500: 200).json({mongo: mongoResult});
};

Testing

After cloning the repo run vagrant up then npm test.

Readme

Keywords

Package Sidebar

Install

npm i mongo-healthcheck

Weekly Downloads

104

Version

2.0.1

License

MIT

Last publish

Collaborators

  • jeffreycharles