Skip to content

nodules/requestid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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