Performance: req.method and req.url
LOW IMPACT
These properties affect how the server processes requests but have minimal impact on frontend page speed or rendering.
app.get('/data', async (req, res) => { const data = await fetchDataAsync(); res.send(data); });
app.use((req, res, next) => {
if (req.method === 'GET' && req.url === '/data') {
// heavy synchronous processing
for (let i = 0; i < 1e7; i++) {}
res.send('Data');
} else {
next();
}
});| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using req.method and req.url for routing | 0 (server-side) | 0 (server-side) | 0 (server-side) | [OK] Good |