freecoding.school100% FREE · NO SIGNUP
Endpoint BayISSUE #15 of 45

resources · nouns over verbs

RestaVSThe 401 Bandit
Resta saysResources are nouns; design URLs around things, with sub-resources for relationships.

Name resources as plural nouns (/users, /products). A specific one is /users/42. Relationships nest: /users/42/orders lists that user's orders. Keep verbs out of URLs — the HTTP method is the verb. Consistent, hierarchical nouns make an API guessable, which is half of good design.

Power-ups you unlock

The 401 Bandit attacks — common mistakes

Boss battleDesign URLs for a blog: posts, a single post, and a post’s comments.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>/posts            all posts
/posts/7          one post
/posts/7/comments its comments</pre></body></html>
▶ Open the interactive comic issue
‹ Rest Principles · Stateless · Uniform · CacheableCrud · The Four Basic Ops ›