Build HTTP APIs with routing, middleware, validation, controllers, and error handling.
Lessons
Set up a typed Express project with build and dev tooling.
Express with TypeScript is easiest to learn by reading the example, changing it, and observing the result.
// npm install --save-dev typescript @types/express
import express, { Request, Response } from 'express';
interface Lesson { slug: string; title: string; }
const app = express();
app.get('/api/lessons/:slug', (req: Request, res: Response) => {
const lesson: Lesson = { slug: req.params.slug, title: 'Typed lesson' };
res.json(lesson);
});
app.listen(3000);Practice the Express with TypeScript example in a small scratch file, then explain what changed and why.