connect-stack

Create a new connect middleware function from multiple other middleware functions

npm install connect-stack
208 downloads in the last month

connect-stack

Stack multiple connect/express middlewares into a single middleware function

example

myauth.js:

var stack = require('connect-stack'),
    connect = require('connect');

function myAuth(req, res, next) {
    //TODO: write auth code
}

module.exports = stack(connect.cookieParser(), 
    connect.session({secret: 'hush'}),
    myAuth);

app.js

app.use('/secret-area', require('./myauth'));
npm loves you