Build HTTP APIs with routing, middleware, validation, controllers, and error handling.
Lessons
Define models and relations with the Sequelize ORM.
Sequelize ORM is easiest to learn by reading the example, changing it, and observing the result.
// npm install sequelize pg
import { Sequelize, DataTypes } from 'sequelize';
const sequelize = new Sequelize(process.env.DATABASE_URL);
const Lesson = sequelize.define('Lesson', {
slug: { type: DataTypes.STRING, unique: true },
title: DataTypes.STRING
});
await sequelize.sync();
const lesson = await Lesson.create({ slug: 'express-orm', title: 'ORM basics' });
console.log(lesson.toJSON());Practice the Sequelize ORM example in a small scratch file, then explain what changed and why.