README
wrap-middleware
Wraps middleware and provide way to attach code before and after it.
Install
$ npm install --save wrap-middleware
Usage
var wrapMiddleware = require('wrap-middleware');
var myMw = function (req, res, next) { next(); };
wrapMiddleware(myMw)
.before(function (req, res, next) {
// Called before
})
.after(function (req, res, next) {
// Called after
});
//=> wrapped middleware
API
wrapMiddleware(middleware)
middleware
Required
Type: Function
Middleware, that should be wrapped.
.before(cb)
Attaches cb
, that will be called before wrapped middleware.
.after(cb)
Attaches cb
, that will be called after wrapped middleware.
License
MIT © Vsevolod Strukchinsky