Build HTTP APIs with routing, middleware, validation, controllers, and error handling.
Lessons
Use all CPU cores and scale across processes.
Clustering and Scaling is easiest to learn by reading the example, changing it, and observing the result.
import cluster from 'node:cluster';
import { cpus } from 'node:os';
if (cluster.isPrimary) {
for (let i = 0; i < cpus().length; i++) cluster.fork();
cluster.on('exit', () => cluster.fork());
} else {
const { default: app } = await import('./app.js');
app.listen(3000);
}Practice the Clustering and Scaling example in a small scratch file, then explain what changed and why.