#[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("/response")]
struct Response;
impl ServerHook for Response {
async fn new(_: &mut Stream, _: &mut Context) -> Self {
Self
}
#[response_body("response")]
async fn handle(self, stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }
}§Parameters
path: String literal defining the route path
§Dependencies
This macro depends on the #[hyperlane(server: Server)] macro to define the server instance.