Skip to content
Ameen Abozaid
Planned lessonJNR-018-L01

Resources, not functions

  • Lesson 1 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

think in nouns (things) rather than verbs (actions).

Planned topics

  • A resource is a thing the API exposes: a product, a category, an order.
  • A collection is a group of resources (/products). A sub-resource belongs to a parent (/orders/7/items).
  • The HTTP method is the verb. The URL is the noun.
  • Model from the domain requirements, not from database tables.
  • The contract should not leak internal structure such as table names or database IDs by accident.
Draft outline details

Demonstration

Bad (functions)Good (resources)
POST /createProductPOST /products
GET /getOrderItems?id=7GET /orders/7/items

Check your understanding

What is the verb in DELETE /products/5?

Show answer

DELETE, the method, not the path.

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.