Skip to content

Generates a unique Request ID for every incoming HTTP request.

License

Notifications You must be signed in to change notification settings

koa-modules/x-request-id

Folders and files

NameName
Last commit message
Last commit date

Latest commit

77d7185 · Nov 24, 2015

History

12 Commits
Nov 23, 2015
Nov 23, 2015
Nov 24, 2015
Jan 24, 2015
Nov 24, 2015
Nov 23, 2015
Nov 24, 2015
Nov 23, 2015

Repository files navigation

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.

NPM version NPM Downloads Build status Test coverage Dependency status License

Install

$ npm install --save koa-x-request-id

Usage

=2.x, working with koa-v2

app.use(xRequestId({ key, noHyphen, inject }, [app]))
const Koa = require('koa')
const xRequestId = require('koa-x-request-id')
const app = new Koa()

// key defaults to `X-Request-Id`
// if `noHyphen = true`, generates 32 uuid, no hyphen `-`.
// if `inject = true`, `ctx.id = uuid`
app.use(xRequestId({key, noHyphen, inject}, app))

=1.x

app.use(xRequestId(app, { key, noHyphen, inject }))
var koa = require('koa')
var xRequestId = require('koa-x-request-id')
var app = koa()

// key defaults to `X-Request-Id`
// if `noHyphen = true`, generates 32 uuid, no hyphen `-`.
// if `inject = true`, `ctx.id = uuid`
app.use(xRequestId({key, noHyphen, inject}, app))

About

Generates a unique Request ID for every incoming HTTP request.

Resources

License

Stars

Watchers

Forks

Packages

No packages published