Skip to content

Commit ff6c712

Browse files
committed
remove bullets and made "request" a header
1 parent 62ce1dc commit ff6c712

File tree

1 file changed

+12
-9
lines changed
  • module3-crud-and-data-models/r1-schema-and-data-models

1 file changed

+12
-9
lines changed

module3-crud-and-data-models/r1-schema-and-data-models/README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,44 +53,47 @@ In a REST environment, CRUD often corresponds to the HTTP methods `POST`, `GET`,
5353

5454
For example, imagine we are working with a system that is keeping track of meals and their corresponding prices for a restaurant. Let’s look at how we would implement CRUD operations.
5555

56-
- #### Create
56+
#### Create
5757

5858
To create resources in a REST environment, we most commonly use the HTTP POST method. POST creates a new resource of the specified resource type.
5959
Imagine that we are adding a new food item to the stored list of dishes for this restaurant, and the dish objects are stored in a dishes resource.
6060

6161
Note: Use `POST` when you want to add a child resource under resources collection.
6262

63-
Request:
63+
##### Request:
64+
6465
`POST http://www.myrestaurant.com/api/dishes/`
6566

6667
We will need to send the `dish` data too.
67-
`
6868

69-
- #### Read
69+
#### Read
7070

7171
To read resources in a REST environment, we use the GET method. in practice, reading a resource shouldn't change any information - it should only retrieve it.
7272

7373
Note: technically, you can change data in a `GET` request but since we are creating a RESTful API, you shouldn't do that, and, in-general, changing data in a `GET` request would be confusing to the users of your api.
7474

75-
Request:
75+
##### Request:
76+
7677
`GET http://www.myrestaurant.com/api/dishes/`
7778

78-
- #### Update
79+
#### Update
7980

8081
PUT is the HTTP method used for the CRUD operation, Update.
8182
So if the price of Avocado Toast has gone up, we should go into the database and update that information using PUT.
8283

8384
Note: Use `PUT` when you want to modify a singular resource which is already a part of resources collection. `PUT` replaces the resource with the data you send in its entirety.
8485

85-
Request:
86+
##### Request:
87+
8688
`PUT http://www.myrestaurant.com/dishes/1223`
8789

88-
- #### Delete
90+
#### Delete
8991

9092
The CRUD operation Delete corresponds to the HTTP method DELETE. It is used to remove a resource from the system.
9193
Let’s say that the world avocado shortage has reached a critical point, and we can no longer afford to serve this modern delicacy at all. We should go into the database and delete the item that corresponds to `"Avocado Toast"`, which we know has an `id` of 1223.
9294

93-
Request:
95+
##### Request:
96+
9497
`DELETE http://www.myrestaurant.com/dishes/1223`
9598

9699
## Resources

0 commit comments

Comments
 (0)