Lesson 1.2

Designing resources and URLs

A URL should name a thing.

12mBeginner20.3k students

Overview

Things, not procedures

A URL should name a thing. Verbs belong in the method, so listing, fetching, and deleting a user are one path with three methods rather than three paths.

Nest a path only when the child genuinely belongs to the parent and cannot be addressed without it. Deeply nested paths become unusable the moment a resource needs to be reached another way.

Consistency beats elegance. Plural nouns everywhere, one casing convention, one date format — an API that is predictable is one people can guess correctly.

In this lesson you will:

  • Name resources as nouns, consistently
  • Nest only where ownership is real
  • Keep identifiers stable

Resources

Previous Lesson
Next Lesson
Designing resources and URLs — API Design with Node.js — Vertex