Routing
Andurel keeps route declarations separate from controller registration and provides typed URL helpers for application links.
Declare a route
Routes use the independently versioned routing package:
1import "github.com/mbvlabs/andurel/pkg/routing"
2
3var ProductShow = routing.NewRouteWithUUIDID(
4 "/products/:id",
5 "products.show",
6 "",
7)
Use the helper instead of hard-coding an application URL:
1routes.ProductShow.URL(product.ID)
Register a handler
Controllers register Echo routes with the application router:
1_, err := r.AddRoute(echo.Route{
2 Method: http.MethodGet,
3 Path: routes.ProductShow.Path(),
4 Name: routes.ProductShow.Name(),
5 Handler: products.Show,
6})
The router and controllers are Fx modules. Dependencies are constructor parameters; do not store them in an Echo or standard-library context.
Inspect and export routes
1andurel routes --json
2andurel generate routes
The manifest reports route names, paths, parameters, and source locations. In Inertia projects, the generator uses that same manifest to write resources/js/routes.ts.