1.0.3 • Published 5 years ago
koa-health-probe v1.0.3
koa-health-probe
Health probe for Koa that uses http://github.com/katlimruiz/koa-last-request to provide a bit meaningful info
Usage
const Koa = require('koa');
const KoaRouter = require('koa-router');
const setupKoaHealthProbe = require('koa-health-probe');
// create koa app
var app = new Koa();
var router = new KoaRouter();
// setup the probe
setupKoaHealthProbe(router, youroptions);
// setup routes on the app
app.use(router.routes()).use(router.allowedMethods());
Options
var options = {
// route path to use, default is /tools/probe
path: string,
// function to customize the object returned for every probe tryout
onRequest: function
}
Optional dependency on http://github.com/katlimruiz/koa-last-request
The package koa-last-request
is used to provide the last timestamp the koa app has processed something (you can configure it to ignore certain paths, for example, this probe :)).
If the package is not present, then the timestamp is not generated.