🌐Web Routing
Also known as Routing, Route
Matching each web address to the page or code that handles it.
Think of it like
Think of it like a post room. Each letter goes to the right desk based on the name on it.
Example
Jack's shop has a route for /orders/:id. When Emma visits /orders/42, the code loads order 42.
Why it matters
Routes are the map of your app. Clear routes make clear web addresses.
Definition
Example code
javascript
app.get("/orders/:id", (req, res) => {
res.send(`Order ${req.params.id}`);
});Common mistake
Key takeaways
- 1Path to code. Each address has a handler.
- 2Server or browser. Both can route.
- 3Paths carry inputs. Like the id in /orders/42.