context-middleware

1.0.0 • Public • Published

context-middleware

Attach req.context to all express requests.

Example

var context = require('context-middleware');
 
var app = express();
app.use(context());
app.use('/user', function (req, res, next) {
  var id = req.param('id');
  users.get(id, function (err, user) {
    req.context.user = user;
    next();
  });
});

API

context()

Generate a context middleware.

License

WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|

Readme

Keywords

none

Package Sidebar

Install

npm i context-middleware

Weekly Downloads

0

Version

1.0.0

License

none

Last publish

Collaborators

  • segmentio
  • ivolo