Performance: Health check endpoints
MEDIUM IMPACT
Health check endpoints affect server responsiveness and overall user experience by providing quick status feedback without heavy processing.
app.get('/health', (req, res) => { res.json({ status: 'ok' }); });
app.get('/health', (req, res) => { // Simulate heavy DB query or complex logic const data = heavyDatabaseQuery(); res.json({ status: 'ok', data }); });
| Pattern | Server Load | Response Time | Event Loop Blocking | Verdict |
|---|---|---|---|---|
| Heavy synchronous logic in health check | High | Slow | Blocks event loop | [X] Bad |
| Simple static response | Minimal | Fast | Non-blocking | [OK] Good |