Skip to main content

Module routing

Module routing 

Source
Expand description

Method routers and per-operation metadata.

ⓘ
App::new().route(
    "/users",
    post(create_user).status(201).summary("Create a user").tag("users")
        .get(list_users).tag("users"),
)

Metadata methods (summary, tag, status, …) apply to the most recently added method. Route macros (#[post(...)]) expand to exactly these calls.

Structs§

MethodRouter
Maps HTTP methods to handlers for a single path.
OperationMeta
Static metadata attached to one operation.
Route
A path plus its method router; produced by route macros and routes![].

Functions§

delete
Route DELETE requests to handler.
get
Route GET requests to handler.
head
Route HEAD requests to handler.
options
Route OPTIONS requests to handler.
patch
Route PATCH requests to handler.
post
Route POST requests to handler.
put
Route PUT requests to handler.