#[get]Expand description
Restricts function execution to HTTP GET requests only.
This attribute macro ensures the decorated function only executes when the incoming request uses the GET HTTP method. Requests with other methods will be filtered out.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/get")]
struct Get;
impl ServerHook for Get {
async fn new(_ctx: &Context) -> Self {
Self
}
#[prologue_macros(get, response_body("get"))]
async fn handle(self, ctx: &Context) {}
}
impl Get {
#[get]
async fn get_with_ref_self(&self, ctx: &Context) {}
}
#[get]
async fn standalone_get_handler(ctx: &Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &Context parameter.