Routing — Aquilia Documentation
Comprehensive guide and documentation for Routing in the Aquilia framework. View API reference, examples, and implementation patterns.
Core / Routing Routing Aquilia features a highly optimized, compile-time routing engine. By declaring route patterns directly on controller methods via decorators, routes are parsed, analyzed, and compiled at application startup to provide near-zero matching overhead. Syntax Deprecation & Removal Warning The legacy angle bracket parameter syntax (e.g. or «id:int») has been completely removed from the framework. Using it will result in compilation and runtime matching failures. You must use the modern curly brace format (e.g. "}) for all parameterized paths. Route Declaration & Nesting In Aquilia, controllers act as routing namespaces. The class-level prefix is automatically merged with method-level path templates during compilation: Response: # Resolves to: GET /api/articles return Response.json( ) @GET("/ ") async def get_article(self, ctx: RequestCtx, id: int) -> Response: # Resolves to: GET /api/articles/42 return Response.json( )`} /> Route Specificity Scoring Aquilia avoids matching order bugs by sorting routes mathematically based on segment specificity. When matching a path, the router evaluates routes from the highest specificity score to the lowest: Route Pattern Match Target Specificity Score ', '/users/42 (Integer segment match)', '150 (Static + Typed parameter +50)'], ['/users/ ', '/users/john (Generic string match)', '125 (Static + Untyped parameter +25)'], ['/users/*path', '/users/profile/settings (Wildcard catch-all)', '101 (Static + Splat segment +1)'] ].map(([pattern, target, score], i) => ( ))} Guides & Reference Pattern Syntax & constraints Curly brace pattern grammar, types, constraints, and validation. URL Generation Reverse path routing using url_for and query parameters. )
Go to Homepage