methods

Attribute Macro methods 

Source
#[methods]
Expand description

Allows function to handle multiple HTTP methods.

This attribute macro configures the decorated function to execute for any of the specified HTTP methods. Methods should be provided as a comma-separated list.

ยงUsage

use hyperlane::*;
use hyperlane_macros::*;

#[route("/get_post")]
struct GetPost;

impl ServerHook for GetPost {
    async fn new(_ctx: &Context) -> Self {
        Self
    }

    #[prologue_macros(
        http,
        methods(get, post),
        response_body("get_post")
    )]
    async fn handle(self, ctx: &Context) {}
}

The macro accepts a comma-separated list of HTTP method names (lowercase) and should be applied to async functions that accept a &Context parameter.