BeeTech-global / bee-health-check

Health check to express and restify projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bee Health Check

npm version Dependencies Build Status Codacy Badge

Health check to express and restify projects

Install

npm install -S bee-health-check

Usage

const restify = require('restify');
const healthCheck = require('bee-health-check');

const app = restify.createServer();

const options = {
  healthFn = (req, res) => Promise.resolve({ ok: true }), // default
  successStatusCode = 200, // default
  failureStatusCode = 503 // default
}

app.get('/health-check', healthCheck(options));

options

Name Type Description default
healthFn Promise.<Object, Error> Promise based function to check api health, the response will be sent as application/json (req, res) => Promise.resolve({ ok: true })
successStatusCode number Status code to be sent when healthFn fullfilled 200
failureStatusCode number Status code to be sent when healthFn rejected 503

About

Health check to express and restify projects


Languages

Language:JavaScript 100.0%