#[controller]Expand description
A macro that generates into_router and into_app_router methods which
automatically wire up all #[route] handlers and the given middlewares,
path-prefix etc.
ยงSyntax:
use axum_controller::controller;
struct ExampleController;
#[controller(
path = "/asd",
)]
impl ExampleController { /* ... */ }- path
- optional, 0-1 allowed, defaults to
"/" - A path to prefix
.nesttheroutesin the controller Struct under
- optional, 0-1 allowed, defaults to
- state
- optional, 0-1 allowed, defaults to
"()") - The type signature of the state given to the routes
- optional, 0-1 allowed, defaults to
- middleware
- optional, 0-n allowed, default to [] (no middlewares)
- Middlewares to
.layerin the created router