Overview
Aeros provides a simple and expressive routing system. Routes are typically defined in theroutes/web.php file and support all standard HTTP methods.
Supported HTTP Methods
The Router class supports the following HTTP methods:get- Retrieve resourcespost- Create new resourcesput- Update/replace resourcespatch- Partially update resourcesdelete- Remove resources
Basic Route Registration
Routes are registered using static method calls on theRoute class. Each method accepts a URI path and a handler (either a closure or a controller reference).
GET Routes
Use GET routes to retrieve and display resources:POST Routes
Use POST routes to create new resources:PUT Routes
Use PUT routes to update or replace entire resources:PATCH Routes
Use PATCH routes to partially update resources:DELETE Routes
Use DELETE routes to remove resources:Route Handlers
Closure Handlers
You can use anonymous functions (closures) as route handlers:Controller Handlers
For better organization, you can reference controller methods using the@ syntax:
index method:
Controller handlers are automatically resolved from the
\App\Controllers\ namespace and must extend \Aeros\Src\Classes\Controller.Route Files
By default, routes are loaded fromroutes/web.php. You can organize routes into separate files and load them conditionally:
Next Steps
Route Parameters
Learn how to capture dynamic segments in your routes
Middleware
Add middleware to protect and process routes