@juntoz/koa-last-request
v1.0.3
Published
Stores information about the last request of a Koa application
Downloads
2
Keywords
Readme
koa-last-request
Stores information about the last request of a Koa application.
Intro
The idea behind this library is to get a hold of generic information about the last request that the application processed.
Although it is a simple concept and it may be used of other purposes, my intended usage is to be able to tell whether the application is still alive or not.
So if you use it paired with a health probe endpoint you can tell when was the last time the application processed something.
Options
options = {
// array of partial paths that need to be ignored. The match will be made using String.indexOf >= 0.
pathsToIgnore: [],
// optional event to customize further the info to be stored
onStamp: (ctx, lastRequestInfo) => { }
}
Usage
// require
const lastreq = require("koa-last-request");
// setup
var koa = new Koa();
koa.use(lastreq({ /* my options */ });
// use it
console.log(koa.lastRequest);
Feedback
Feedback and contributions are more than welcome
TODO
Tests Eslint