A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/floatdrop/express-request-id below:

floatdrop/express-request-id: Middleware for setting unique request id

Generates UUID for request and add it to header.

npm install express-request-id
import express from 'express';
import requestID from 'express-request-id';

app.use(requestID());

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-2d8338b3ea22

Type: object

Type: function Default: func(req) { return uuidv4(); }

Defines function, that generated ID from request. By default used uuid module, that generated UUID V4 for every request.

Type: string Default: X-Request-Id

Defines name of header, that should be used for request ID checking and setting.

Type: bool Default: true

If false – header will not be set.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4