@appliedblockchain/koa-healthcheck
v1.3.0
Published
Koa healthcheck middleware
Downloads
273
Maintainers
Keywords
Readme
Koa Healthcheck Middleware
Installation:
npm -i @appliedblockchain/koa-healthcheck
and in your application:
const healthcheck = require('@appliedblockchain/koa-healthcheck');
The default will use the path /health
:
app.use(healthcheck())
With a custom path:
app.use(healthcheck({ path: '/custompath' }))
With a custom report object (appended):
app.use(healthcheck({ custom: {
foo: 'bar',
bin: () => 'baz'
} }))
Healthcheck Token:
If healthcheck token is not provided, healthcheck would not show detail information about server.
const HEALTH_TOKEN = 'example-token-1234567890'
app.use(healthcheck({ custom: {
foo: 'bar',
bin: () => 'baz'
}}, HEALTH_TOKEN ))
Provides detail information about server:
curl -X GET -H "health-token:example-token-1234567890" localhost:3000/health
Provides minimal/custom information only:
curl -X GET localhost:3000/health