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 ruleP2stack specificStack: node
apiresponse-shapecleanup
Don't re-wrap an object you return as a JSON response
When the value is already an object, pass it directly to res.json(value) instead of wrapping it in another object literal.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | return res.status(HTTP_STATUS.OK).json({ response }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | return res.status(HTTP_STATUS.OK).json(response); |
Explanation (EN)
Objašnjenje (HR)