In real world, we use databases to store our data, but for this exercise we will use a simple array to store our todos.
var todosArray = []Implement the GET /todos endpoint, that sends all the todos to the client
Hint
Read about JSONImplement the POST /todos endpoint, that adds a new todo to the array.
This receives the todo in the request body, and adds it to the array.
The body looks like:
{
todo: "Eat Food"
}Hint
Read about how to get data from the request bodyImplement the DELETE /todos/:id endpoint, that deletes a todo from the array.
Implement the PATCH /todos/:id endpoint, that updates a todo from the array.
This receives the updated todo in the request body, and updates it in the array.
The body looks like:
{
todo: "Stop eating junk food"
}