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