Skip to content

BeeTech-global/bee-server-health-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bee Server Health Check

Health check to express and restify projects

Install

npm install -S @beetech/bee-server-health-check

Usage

const Koa = require('koa');
const healthCheck = require('@beetech/bee-server-health-check');

const app = new Koa();

const options = {
  healthFn = async (ctx) => ({ ok: true }), // default
  successStatusCode = 200, // default
  failureStatusCode = 503 // default
}

app.use(healthCheck(options));
// use some koa route to put it in an endpoint
// app.use(koaRoute.get('/health-check', healthCheck(options))); 

options

Name Type Description default
healthFn Promise.<Object, Error> Promise based or async function to check api health, the response will be sent to ctx.body async (ctx) => ({ 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

Developers standard repository

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors