On September 19, 2025, we continued our hands-on with Node.js + Express + Sequelize (MySQL). We extended the CRUD functionality by adding endpoints to list, create, and delete users. The next task is to rebuild everything and add the edit (update) endpoint.
- Node.js + Express
- Sequelize (ORM) — MySQL
- dotenv for env management
.
├─ src/
│ ├─ routes/
│ ├─ controllers/
│ ├─ models/
│ └─ config/
├─ public/
├─ .env.example
├─ package.json
└─ README.md
git clone https://github.com/learn-crudzaso/nodejs-session-2.git
cd nodejs-session-2
npm installCreate a .env file based on .env.example:
# Database
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=your_database
DB_DIALECT=mysql
# App
PORT=3000- Create the database in MySQL (
your_database). - Ensure credentials in
.envmatch. - (Optional) Run Sequelize sync or migrations.
Start the project with:
node src/index.jsOr with nodemon (if installed):
npx nodemon src/index.jsGET /users→ list usersPOST /users→ create new userDELETE /users/:id→ delete user by ID
Rebuild the CRUD and add the update endpoint:
PUT /users/:idorPATCH /users/:idInclude validation, not-found handling, and correct status codes.