Build HTTP APIs with routing, middleware, validation, controllers, and error handling.
Lessons
Add live, two-way communication alongside your REST API.
Real-Time with Socket.IO is easiest to learn by reading the example, changing it, and observing the result.
// npm install socket.io
import { createServer } from 'node:http';
import express from 'express';
import { Server } from 'socket.io';
const app = express();
const httpServer = createServer(app);
const io = new Server(httpServer);
io.on('connection', socket => {
socket.on('lesson:message', text => {
io.emit('lesson:message', { text, at: Date.now() });
});
});
httpServer.listen(3000);Practice the Real-Time with Socket.IO example in a small scratch file, then explain what changed and why.