beyondasset-request-id
Express.js request-id middleware.
Last updated 7 months ago by tech1k .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install beyondasset-request-id 
SYNC missed versions from official npm registry.

Build Status Coverage Status npm version

request-id

Express.js request-id middleware.
Allows you to identify client requests within non-sequential logs by adding a response header of X-Request-Id. Allows setting value via query parameter or request header.

Installation

$ npm install beyondasset-request-id

Running the tests

$ npm install
$ mocha

API

var requestId = require('beyondasset-request-id')

requestId(options)

Create new request-id middleware.

options

See request-id options. Exception: Default value generator function: uuid-1345.v4fast

Example

var express = require('express')
var app = express()
var requestId = require('beyondasset-request-id')
var bodyParser = require('body-parser')

app.use(requestId())
app.use(bodyParser())
app.get('/test', function (req, res, next) {
  res.send('OK')
})
app.listen(8080)

test it:

curl http://localhost:8080/test -I | grep X-Request-Id

outputs:

X-Request-Id: 98401c07-e91a-40ca-813e-5407970de407

License

MIT

Current Tags

  • 0.1.1                                ...           latest (7 months ago)

1 Versions

  • 0.1.1                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |