Performance: next() function and flow control
MEDIUM IMPACT
This affects server response time and middleware execution flow, impacting how quickly the server can handle requests and send responses.
app.use((req, res, next) => {
// some logic
next(); // pass control to next middleware
});
app.use((req, res, next) => {
res.send('Done');
});app.use((req, res, next) => {
// some logic
// missing next() call
});
app.use((req, res, next) => {
// this middleware never runs
next();
});| Pattern | Middleware Calls | Blocking Risk | Response Delay | Verdict |
|---|---|---|---|---|
| Missing next() call | Middleware chain hangs | High | High delay or hang | [X] Bad |
| Proper next() usage | Middleware chain continues smoothly | None | Minimal delay | [OK] Good |