Let's have a look at the concept of request and the different HTTP request methods.
We will first look at HTTP request methods (sometimes referred to as HTTP verbs), then apply them to our API using a simple todo list example. We will look at five major ones:
GET: Requests a representation of the specified resource. Requests using
GETshould only retrieve data, and should not be used to make changes to resources.
POST: Is used to submit an entry to a specified resource, often causing a change of state.
PUT: Replaces all current representations of the target resource with the request payload.
DELETE: Deletes the specified resource.
PATCH: Used to apply partial modifications to a resource.
In the following exercises, we're going to rewrite our previous code where we had hardcoded our data so that we can work with real and dynamic...