Performance: Async error handling in routes
MEDIUM IMPACT
This affects server response time and user experience by managing asynchronous errors efficiently without blocking the event loop.
app.get('/data', async (req, res, next) => { try { const data = await fetchData(); res.send(data); } catch (err) { next(err); } });
app.get('/data', async (req, res) => { const data = await fetchData(); res.send(data); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No async error handling | N/A | N/A | N/A | [X] Bad |
| Try-catch with next() in async route | N/A | N/A | N/A | [OK] Good |