route

Attribute Macro route 

Source
#[route]
Expand description

Registers a function as a route handler.

This attribute macro registers the decorated function as a route handler for a given path. This macro requires the #[hyperlane(server: Server)] macro to be used to define the server instance.

§Usage

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

#[route("/")]
async fn route(ctx: Context) {
    // function body
}

§Parameters

  • path: String literal defining the route path

§Dependencies

This macro depends on the #[hyperlane(server: Server)] macro to define the server instance.