Session 2
Express, MVC & Sequelize : V2
Session Summary
We extended the CRUD in our Express + Sequelize app. Implemented GET /users, POST /users, and DELETE /users/:id with basic validation and error handling. The next step is to redo the flow and add the edit feature.
- GET /api/v1/users: list users
- POST /api/v1/users: create user
- DELETE /api/v1/users/:id: remove user
Questions to think about
- What HTTP status codes did you choose for create, list, and delete, and why?
- How would you validate request payloads before hitting the controller (where and how)?
Challenge — Rebuild & Add Edit
Rebuild the CRUD from scratch and add the edit endpoint:
PUT /users/:id or PATCH /users/:id. Include: input validation, not-found handling, and proper HTTP status codes. Optional: pagination for list and centralized error middleware.