Skip to content

How to design routes well

Nouns, HTTP methods for actions, stable identifiers, and no verb in path.

Routes that age

  1. Nouns, not verbs

    GET /users/42, not GET /getUser?id=42.

  2. HTTP method = action

    GET read, POST create, PUT replace, PATCH update, DELETE remove.

  3. Stable identifiers in path

    Slugs and IDs, not state (/users/current-user-with-name-ana).

  4. Order matters

    Specific routes before generic: /users/me before /users/{id}.

  5. Version the contract

    /v1/users/42 lets you break without breaking clients.