route_params

Attribute Macro route_params 

Source
#[route_params]
Expand description

Extracts all route parameters into a collection variable.

This attribute macro retrieves all available route parameters from the URL path and makes them available as a collection for comprehensive route parameter access.

ยงUsage

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

#[route("/route_params/:test")]
struct RouteParams;

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

    #[response_body(&format!("request route params: {request_route_params:?}"))]
    #[route_params(request_route_params)]
    async fn handle(self, ctx: &Context) {}
}

The macro accepts a variable name that will contain all route parameters. The variable will be available as a collection in the function scope.