express-service-health

express middleware to provide a simple health check endpoint for a service

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
express-service-health
001.0.16 years ago6 years agoMinified + gzip package size for express-service-health in KB

Readme

express-service-health
express middleware to provide a simple health check endpoint for a service

Build StatusCoverage StatusISC LicenseNodeJS
JavaScript Style Guide

api

const health = require('express-service-health')
health(express.Router[, endpoint])
health is the default value for the endpoint

example

const health = require('express-service-health')
const express = require('express')

const service = express()

const router = express.Router()

router.get(
    '/hello-world',
    (req, res) => { res.send('hello world') }
)

service.use(serviceHealth(express.Router))
service.use('/', router)

request('some uri')
  .get('/health')
  .end((err, res) => {
    // err
    // res.statusCode or res.status = 200
    // res.body = { uptime: `uptime value` }
  })

ISC License (ISC)