[−][src]Attribute Macro kayrx::get
#[get]
Macro codegen module
Generators for routes and scopes
Routefor use
Macros:
Attributes:
"path"
- Raw literal string with path for which to register handle. Mandatory.guard="function_name"
- Registers function as guard usingkayrx::web::guard::fn_guard
Notes
Function name can be specified as any expression that is going to be accessible to the generate
code (e.g my_guard
or my_module::my_guard
)
Example:
use kayrx::web::HttpResponse; use kayrx_macro::get; use futures::{future, Future}; #[get("/test")] async fn async_test() -> Result<HttpResponse, kayrx::web::Error> { Ok(HttpResponse::Ok().finish()) }
Creates route handler with GET
method guard.
Syntax: #[get("path"[, attributes])]
Attributes:
"path"
- Raw literal string with path for which to register handler. Mandatory.guard="function_name"
- Registers function as guard usingkayrx::web::guard::fn_guard