Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

express-pass-id

0.0.2 • Public • Published

Express-Pass-Id

Simple express middleware module, inspired by express-request-id.

It allows passing prefixes for unique request IDs and using custom headers (because x-request-id is often already used).

Installation

npm install express-pass-id

Usage

config.json

{
  "prefix": "myService1",
  "header": "x-my-id"
}

express app file

var 
    express       = require('express'),
    app           = express(),
    config        = require('./config.json'),
    expressPassId = require('express-pass-id.js')(config),
    rp = require('request-promise');
 
app.use(expressPassId);
 
app.post('/login', function (req, res) {
  console.log('Processing route /login, id '+req.id); //print custom ID
  
  var options = {
      uri: 'https://google.com',
      headers: req.passHeaders //Here we pass our custom header
  };
   
  rp(options)
    //....
});

Keywords

none

install

npm i express-pass-id

Downloadsweekly downloads

8

version

0.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability