Build HTTP APIs with routing, middleware, validation, controllers, and error handling.
Lessons
Group routes, controllers, and models by feature.
Modular Feature Architecture is easiest to learn by reading the example, changing it, and observing the result.
// routes/lessons.js
import { Router } from 'express';
const router = Router();
router.route('/')
.get((req, res) => res.json({ lessons: [] }))
.post((req, res) => res.status(201).json({ created: true }));
export default router;
// app.js
import express from 'express';
import lessons from './routes/lessons.js';
const app = express();
app.use('/api/lessons', lessons); // mount the router
app.listen(3000);Practice the Modular Feature Architecture example in a small scratch file, then explain what changed and why.