Route Params and Query
Use /users/:id for path params (req.params). Use ?page=1 for query strings (req.query). Validate both.
- Params are strings โ coerce numbers carefully.
- Never trust client input.
- 404 when a resource is missing.
const params = { id: "42" };
console.log(params.id);
After you read this chapter, use Write (when available) and Quiz on this page to lock it in.