Concept
A router maps a method and path pattern to a handler, with parameters pulled from the path. Group routes by resource and version them from the start so a redesign does not break existing clients.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Routing doing its job.
import Fastify from "fastify";
const app = Fastify();
app.register(async (orders) => {
orders.get("/", listOrders);
orders.get("/:id", getOrder); // req.params.id
orders.post("/", createOrder);
orders.delete("/:id", cancelOrder);
}, { prefix: "/api/v1/orders" });
await app.listen({ port: 3000 });Encoding actions in paths, like /orders/123/cancel with GET. Reads should be safe to repeat; a state change belongs on POST, PATCH or DELETE so proxies and browsers treat it correctly.
Your roadmap puts these before Routing, unless you already know them.
Once a session shows you understand Routing, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Routing.