Skip to content
Ameen Abozaid
Planned lessonJNR-018-L02

URL design

  • Lesson 2 of 6
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

write URLs that are predictable.

Planned topics

  • Use plural nouns for collections: /products, /categories.
  • Identify one item by its ID: /products/5.
  • Nest only one or two levels: /categories/3/products is fine; deeper is hard to use.
  • Lowercase, hyphens for words (/order-items), no trailing slash, no file extensions.
  • Filters, sorting, and paging go in the query string: /products?category=3&sort=price.
Draft outline details

Demonstration

text
GET    /products           list
POST   /products           create
GET    /products/5         read
PUT    /products/5         replace
DELETE /products/5         remove

Check your understanding

Where does ?page=2 belong?

Show answer

In the query string.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.