express-service-health
v1.0.1
Published
express middleware to provide a simple health check endpoint for a service
Downloads
63
Readme
express-service-health
express middleware to provide a simple health check endpoint for a service
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` }
})