#[controller]
Expand description
A macro that generates a into_router(_: State<_>) impl which automatically wires up all route
’s and the given middlewares, path-prefix etc
§Syntax:
ⓘ
#[controller(
path = "/asd",
state = AppState,
middleware=my_middleware
)]
impl ExampleController { /* ... */ }
- path
- optional, 0-1 allowed, defaults to
"/"
- A path to prefix
.nest
theroutes
in 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
.layer
in the created router