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 ruleP1universalStack: node
routingapi-designmaintainability
Avoid colliding base paths across controllers; prefix distinct resources
Two controllers sharing the same base path make routing depend on registration order and subpath overlap; give each resource its own prefix to keep routes unambiguous.
PR: hegnar-user-ws · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | @Controller('api/resource') // controller A |
| 2 | @Controller('api/resource') // controller B — :id vs /sub ordering becomes fragile |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | @Controller('api/resource') // resource root |
| 2 | @Controller('api/resource/items') // distinct sub-resource prefix |
Explanation (EN)
Objašnjenje (HR)