koa-x-request-id
Generates a unique Request ID for every incoming HTTP request. This unique ID is then passed to your application as an HTTP header called
X-Request-Id
.
Install
$ npm install --save koa-x-request-id
Usage
koa-v2
=2.x, working with app.use(xRequestId({ key, noHyphen, inject }, [app]))
const Koa = const xRequestId = const app = // key defaults to `X-Request-Id`// if `noHyphen = true`, generates 32 uuid, no hyphen `-`.// if `inject = true`, `ctx.id = uuid`app
=1.x
app.use(xRequestId(app, { key, noHyphen, inject }))
var koa = var xRequestId = var app = // key defaults to `X-Request-Id`// if `noHyphen = true`, generates 32 uuid, no hyphen `-`.// if `inject = true`, `ctx.id = uuid`app