December 2016
Intermediate to advanced
136 pages
2h 58m
English
© Caio Ribeiro Pereira 2016
Caio Ribeiro Pereira, Building APIs with Node.js , 10.1007/978-1-4842-2442-7_6
Caio Ribeiro Pereira1
(1)São Vicente - SP, São Paulo, Brazil
In this chapter, we’ll continue to explore the new functions from Sequelize and also organize the API’s routes and some middlewares of Express. The create, read, update, delete (CRUD) will be built using the Tasks and Users models.
To start this refactoring, let’s explore the main HTTP methods to CRUDify our application. In this case, we are going to use the functions app.route("/tasks") and app.route("/tasks/:id") to define the path: "/tasks" and "/tasks/(task_id)".
These functions allow us to use nested functions, reusing the routes ...