Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP2universalStack: node
apiroutingresturl-design
Keep required resource identifiers in the path, not the query string
An identifier that is required to resolve a resource belongs in the URL path, not as an optional-looking query parameter.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | router.get('/category', (req) => req.query.categoryId); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | router.get('/category/:categoryId', (req) => req.params.categoryId); |
Explanation (EN)
Objašnjenje (HR)