Skip to content

nodules/requestid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Vladimir Varankin
Dec 7, 2015
a549d84 · Dec 7, 2015

History

7 Commits
Dec 15, 2014
Dec 15, 2014
Dec 15, 2014
Dec 14, 2014
Dec 7, 2015
Dec 15, 2014
Dec 15, 2014
Dec 15, 2014

Repository files navigation

THIS MODULE IS OBSOLETED

The module doesn't work in real (heavy loaded) scenarios. Please consider to use other alternatives if there are some.


requestid Build Status

Allows to get current request identifier passed from the front-end server, e.g. nginx or heroku. One of the module's usecase is to pass the id with application API requests.

Usage

var connect = require('connect'),
    requestId = require('requestid'),
    ask = require('asker'),
    app = connect();

app.use(requestId.createMiddleware());  // set up the middleware
···
app.use(function(req, res, next) {
    ask({
        host : 'example.com',
        headers : {
            'x-request-id' : requestId.get();    // get this request's Id and pass it to the api request
        }
    },
    next);
});

API

requestId.createMiddleware()Function<Request, Response, Function>

Returns the middleware function.

requestId.get()String

Get current request's identifier.

License

MIT

Releases

No releases published

Packages

No packages published