Performance: Response methods and status codes
MEDIUM IMPACT
This concept affects how quickly the server responds and how efficiently the browser processes the response, impacting page load speed and user interaction feedback.
res.status(200).json(data);res.writeHead(200, {'Content-Type': 'application/json'}); res.write(JSON.stringify(data)); res.end();
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual header and body writing | N/A (server-side) | N/A | N/A | [X] Bad |
| Using res.status().json() or res.redirect() | N/A (server-side) | N/A | N/A | [OK] Good |
| Manual redirect with headers | N/A (server-side) | N/A | N/A | [!] OK |
| Using res.status().send() for text | N/A (server-side) | N/A | N/A | [OK] Good |