Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/request-id-middleware
Add a unique requestId uuid to each express request for logging.
https://github.com/segment-boneyard/request-id-middleware
Last synced: about 7 hours ago
JSON representation
Add a unique requestId uuid to each express request for logging.
- Host: GitHub
- URL: https://github.com/segment-boneyard/request-id-middleware
- Owner: segment-boneyard
- Created: 2013-12-11T22:41:08.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-04T19:48:18.000Z (almost 11 years ago)
- Last Synced: 2024-04-09T16:31:14.431Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 124 KB
- Stars: 3
- Watchers: 39
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# request-id-middleware
Add a unique `requestId` uuid to each [express](https://github.com/visionmedia/express) request for logging.
[Koa version](https://github.com/segmentio/koa-request-id).
## Example
```js
var requestId = require('request-id-middleware')();app.get('/', requestId, function (req, res, next) {
res.set({ 'X-Request-Id', req._id });
res.send(200);
});
```## API
### requestId(options)
Generate a request id middleware with `options` defaulting to:```js
{
"header": 'request-id' // read header `request-id`
"param": '_requestId', // try getting it from the param `requestId` too
"key": '_id' // set the request id as `req._id`
}
```## License
```
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
```