api_routes

Attribute Macro api_routes 

Source
#[api_routes]
Expand description

Creates openapi resource handler.

§Syntax

#[api_routes]
#[<method>("path", ...)]
#[<method>("path", ...)]
...

§Attributes

The api_routes macro itself has no parameters, but allows specifying the attribute macros for the multiple paths and/or methods, e.g. GET and POST.

These helper attributes take the same parameters as the single method handlers.

§Examples

#[api_routes]
#[get("/test")]
#[get("/test2")]
#[delete("/test")]
async fn example() -> impl IntoResponse {
    "hello world"
}