Mapping addresses to code.
WHAT A ROUTE DOES
Associates a request address and method with code that handles it.
WHERE THEY ARE DEFINED
In dedicated route files, separated by purpose.
WHAT TO DEFINE
The address pattern The method What handles it
WHAT TO POINT ROUTES AT
Controllers, for anything beyond trivial.
WHY NOT CODE INLINE
Route files become unreadable, and the logic cannot be tested easily.
WHAT PARAMETERS DO
Capture parts of the address for use in the handler.
WHAT TO CONSTRAIN
Parameters, so only valid values match.
WHAT NAMING ROUTES PROVIDES
The ability to generate addresses without repeating them.
WHY THAT MATTERS
Addresses can change without editing every reference.
WHAT GROUPING PROVIDES
Shared prefixes, middleware and namespaces.
WHAT TO ORGANISE BY
Purpose: public, authenticated, administrative, API.
WHAT TO BE CAREFUL WITH
Routes that shadow each other, where a general pattern catches a specific one
WHAT TO CHECK
The route list, which the command-line tool can display.