#[route]
Expand description
Creates resource handler, allowing multiple HTTP method guards.
This method is similar to the actix_web method actix_web::route
§Syntax
#[route("path", method = "HTTP_METHOD"[, attributes])]
§Attributes
"path"
- Raw literal string with path for which to register handler.method="HTTP_METHOD"
- Registers HTTP method to provide guard for. Upper-case string, “GET”, “POST” for example.guard="function_name"
- Registers function as guard usingactix_web::guard::fn_guard
wrap="Middleware"
- Registers a resource middleware.
§Differences
- This macro requires
anyhow::Result
as a return type while the actix macro requiresactix_web::Result
- This macro attaches
#[instrument(skip_all)]
from the tracing library to the function with the correct method name