Performance: Resource-based URL design
MEDIUM IMPACT
This affects how quickly the server can route requests and how efficiently browsers cache resources, impacting page load speed and responsiveness.
app.get('/users/:id', (req, res) => { /* handler */ }); app.get('/users/:id/posts', (req, res) => { /* handler */ });
app.get('/getUserInfo', (req, res) => { /* handler */ }); app.get('/fetchUserPosts', (req, res) => { /* handler */ });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Action-based URLs (e.g., /getUserInfo) | N/A | N/A | Higher due to slower response | [X] Bad |
| Resource-based URLs (e.g., /users/:id) | N/A | N/A | Lower due to better caching | [OK] Good |