URL design
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/productsis 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
GET /products list
POST /products create
GET /products/5 read
PUT /products/5 replace
DELETE /products/5 removeCheck 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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.