Adding middlewares at arbitrary positions on stack #810

Closed
olalonde opened this Issue May 17, 2013 · 1 comment

Comments

Projects
None yet
2 participants

I'd like the ability to programmatically manipulate the middleware stack in this way for example:

app.before('bodyParser').use(function (req, res, next) {
    console.log('before body parser');
    next();
});

app.after('bodyParser').use(function (req, res, next) {
    console.log('after body parser');
    next();
});

I have written a third party module that implements this functionality and I was wondering if there was any chance I'd get a merge if I would implement it directly in Connect. I am planning to add more methods in the future such as app.remove('label'), etc.

The ability to manipulate the stack once it has been built is useful for frameworks that initialize a Connect stack for the user but want to let them modify the stack to their taste afterwards.

Looking forward for feedback.

See https://github.com/olalonde/connectr for the third party module I wrote.

Contributor

jonathanong commented Sep 13, 2013

use his module if you want this, people!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment