Performance: POST route handling
MEDIUM IMPACT
This affects server response time and user experience by how quickly the server processes and responds to POST requests.
app.use(express.json()); app.post('/submit', (req, res) => { const data = req.body; // process data res.send('Done'); });
app.post('/submit', (req, res) => { let body = ''; req.on('data', chunk => { body += chunk; }); req.on('end', () => { const data = JSON.parse(body); // process data res.send('Done'); }); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual body parsing in route | N/A | N/A | N/A | [X] Bad |
| Using express.json() middleware | N/A | N/A | N/A | [OK] Good |