-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middleware should be able to exit the loop #4
Comments
hmm whats the use case? im not sure that fits nicely in the middleware abstraction, usually you want the full stack |
hmm.. good example would be express: var express = require('express');
var app = express();
app.use(function (req, res, next) {
// logic here
req.foo = {};
next();
});
app.use(function (req, res) {
return res.json(req.foo);
});
app.use(function (req, res, next) {
throw new Error('shouldn\'t get here');
});
app.listen(3006); |
i assume that would be handled by just not calling |
i agree the arity stuff does introduce a whole bunch of magic, but i think most people are used to it by now. it's already being used to check if a middleware is an error handler, so not much would have to change. yeah, i think just not calling |
yeah, agreed -- just not calling |
I know this is super old now, but the ability to be able to call
Express and friends don't need this sort of thing because the response is technically the |
Though not ideal, you could call |
FWIW, since the synchronous support update, it's actually difficult to now stop the flow anywhere along the chain making it unusable for middleware flows in something like |
What if we complete our task half-way though the stack?
The text was updated successfully, but these errors were encountered: