Package Exports
- express-request-id
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-request-id) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
express-request-id

Generate UUID for request and add it to X-Request-Id header. In case request contains X-Request-Id header, uses its value instead.
var app = require('express')();
var addRequestId = require('express-request-id')();
app.use(addRequestId);
app.get('/', function (req, res, next) {
res.send(req.id);
next();
});
app.listen(3000, function() {
console.log('Listening on port %d', server.address().port);
});
// curl localhost:3000
// d7c32387-3feb-452b-8df1-2d8338b3ea22API
express-request-id([options])
Returns middleware function, that appends request id to req object.
options
uuidVersion- version of uuid to use (defaults tov4). Can be one of methods from node-uuid.setHeader- boolean, indicates that header should be added to response (defaults totrue).headerName- string, indicates the header name to use (defaults toX-Request-Id).
This options fields are passed to node-uuid functions directly:
- Whole
optionsobject, that can contain fields like:node,clockseq,msecs,nsecs. options.bufferandoptions.offsetto uuid function as second and third parameters.
License
MIT (c) 2014 Vsevolod Strukchinsky (floatdrop@gmail.com)