koa-request-id

1.0.1 • Public • Published

koa-request-id

Add a request id as this.id, if set reusing one from the querystring or headers.

Express version.

build status

Example

var koa = require('koa');
var requestId = require('koa-request-id');
 
var app = koa();
app.use(requestId());
app.use(function*(){
  this.body = this.id;
});
 
app.listen(3000);

Query it:

$ curl http://localhost:3000
23691882-abd8-4857-88f3-41a7f962aefd
 
$ curl http://localhost:3000/?request-id=1337
1337
 
$ curl -H "Request-id: 1337" http://localhost:3000
1337

Installation

$ npm install koa-request-id

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i koa-request-id

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • segment-admin
  • juliangruber