🔥 This exercise is designed to be performed by 1 person.
Technologies: Node, express, express-generator.
We are going to create a REST API that in it we can manage an array of tasks from node/express.
The idea is to create with node and express the different endpoints or routes to perform a CRUD (Create, List, Update, Delete) on an array of tasks.
a) Configure express from scratch.
b) Create the project using express-generator.
💡 Important: save your code to your new repository using add
, commit
and push
.
Take a few minutes to analyze 🤯 your strategy on it, identify the elements that you are going to use as express:
Once the strategy is finished you can start coding, start programming 🎊!
In this project we must build a REST API that exposes the following 4 routes to the internet:
1GET /todos 2POST /todos 3PUT /todos/:position 4DELETE /todos/:position
It should return the existing tasks in the array.
1[ 2 { 3 "done": false, 4 "label": "Sample Todo 1" 5 }, 6 { 7 "done": false, 8 "label": "Sample Todo 2" 9 } 10]
We must be able to send the following data to the endpoint and be able to add said data to the tasks array.
1{ 2 "done": false, 3 "label": "Sample Todo 1" 4}
We must be able to send the following data to the endpoint and be able to update said data in the task array according to its position.
1{ 2 "done": true, 3 "label": "Sample Todo 1" 4}
And return the updated list of all.
You should remove the task from our array according to the position given to the endpoint in the url and return the updated list of tasks.