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: REST / API design
api-designrestnamingconsistency
Design REST routes with a consistent resource hierarchy
Order path segments so nesting reflects ownership (parent before child) and keep the naming scheme consistent with sibling endpoints.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codetext
| 1 | /api/threads/articles // reads as "articles under threads" |
| 2 | // but siblings are flat: /api/all-threads, /api/article-comments |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetext
| 1 | // threads belong to articles, so: |
| 2 | /api/articles/threads |
| 3 | // or stay consistent with the flat sibling scheme: |
| 4 | /api/article-threads |
Explanation (EN)
Objašnjenje (HR)