App Development Vocabulary — Day 14: Route
Day 7 gave us the endpoint: the address a request goes to. Today is what happens on the other side of that address.
A route pairs a path with a handler. The path is the pattern, the handler is the code.
GET /tasks runs the code that lists tasks.
POST /tasks runs the code that creates one.
GET /tasks/12 runs the code that loads task number 12.
Same path, different method, different handler. That's why the CRUD operations from yesterday can share one endpoint.
Routes can hold variables. /tasks/12 and /tasks/13 both match the pattern /tasks/:id. The server pulls out the id and passes it to the handler.
Quick check: A request comes in as DELETE /tasks/12. In plain words, what should the matching handler do?
## SPOKEN LINES
  • You tap a friend's profile and land on the settings screen instead. The address bar says users, 4521, and the server sent back the wrong page. One rule on the server pointed that path at the wrong code.
  • - ROUTE
  • - A route is a rule on the server that matches a path to the code that handles it. The server keeps a list of them. A request comes in, the path is checked against the list, and the matching code runs.
  • - The cart path runs the cart code, users 4521 loads one profile, and orders 88 pulls up a single order.
  • - So a route is the path that sends a request to the right code. Tomorrow: Framework, the ready-made structure most apps are built inside.
## NEXT
Day 15: Framework
0
0 comments
Joshua Payne
4
App Development Vocabulary — Day 14: Route
CMD & Conquer
skool.com/cmdandconquer
Learn to run AI agents from the command line. No API costs, no dev team — just you and your terminal. In-house courses, private repos, live calls.
Leaderboard (30-day)
Powered by