Performance: res.send for general responses
MEDIUM IMPACT
This affects server response time and client perceived loading speed by controlling how quickly the server sends data to the browser.
app.get('/data', async (req, res) => { const data = await fetchDataAsync(); res.json(data); });
app.get('/data', (req, res) => {
const data = fetchDataSync();
res.send(JSON.stringify(data));
});| Pattern | Server Blocking | Response Size | Network Delay | Verdict |
|---|---|---|---|---|
| res.send with sync fetch and manual JSON | High (blocks event loop) | Medium (stringified JSON) | Medium | [X] Bad |
| res.json with async fetch | Low (non-blocking) | Medium (automatic JSON) | Low | [OK] Good |