1.0.1 • Published 7 years ago

express-service-health v1.0.1

Weekly downloads
43
License
ISC
Repository
github
Last release
7 years ago

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)