API-002: Consistent Resource Naming in Endpoints
| Attribute | Value |
|---|---|
| Category | API Design |
| Default Severity | warning |
| Applicable Files | Controller files (*.controller.ts, *.router.ts) |
Why It Exists (Rationale)
REST APIs are resource-oriented, not RPC-oriented. Endpoints represent entities (nouns), while HTTP verbs define actions. Placing verbs in URLs (e.g. /getUser, /createOrder) duplicates the HTTP verb and breaks REST architectural constraints.
Bad Example
// ❌ Action verbs in URI path
router.get("/getUserProfile", handler);
router.post("/createOrder", handler);
router.delete("/removeItem", handler);
Good Example
// ✅ Standard plural nouns with HTTP verbs
router.get("/users/:id", handler);
router.post("/orders", handler);
router.delete("/items/:id", handler);
How It's Detected
ArchStandards extracts string literals representing route paths and verifies they do not contain common action verbs (/get, /create, /update, /delete, /fetch, /remove, /add).