Performance: app.all and app.use for catch-all
MEDIUM IMPACT
This affects server response time and middleware execution order, impacting how fast the server handles requests and sends responses.
app.use((req, res) => { res.status(404).send('Not Found'); });app.all('*', (req, res) => { res.status(404).send('Not Found'); });
| Pattern | Method Checks | Middleware Calls | Response Delay | Verdict |
|---|---|---|---|---|
| app.all('*') | Checks HTTP method for all requests | Called once per request | Slightly higher due to method matching | [!] OK |
| app.use (catch-all) | No method checks, matches all | Called once per request | Lower response delay | [OK] Good |