CRUD and REST
| Resource action | Associated HTTP request |
|---|---|
| Create | POST |
| Read | GET |
| Update | PATCH |
| Delete | DELETE |
REST is an acronym for Representational State Transfer.
Example: managing users
CRUD is a way of talking about the basic actions we might want to perform with users:
- create a new user
- see all the users
- see a particular user
- update a particular user
- delete a particular user
| Resource action | Path/route | HTTP request | Description |
|---|---|---|---|
| Create | /users | POST | Creates a new user with the parcel of data that was POSTed |
| Read | /users | GET | GET a list of all users |
| Read | /users/5 | GET | GET the data of user 5 |
| Update | /users/5 | PATCH | Updates the date of user 5 with data that was PATCHed |
| Delete | /users/5 | DELETE | DELETE / delete user 5 |
/users/new | GET | GET the form for creating a new user | |
/users/5/edit | GET | GET the form for editing a new user |