Skip to main content

route

Attribute Macro route 

Source
#[route]
Expand description

Helper attribute for method-level HTTP route customization.

This attribute is used within #[http] impl blocks to customize individual method routing. It is a no-op on its own.

§Example

#[http(prefix = "/api")]
impl MyService {
    #[route(method = "POST", path = "/custom")]
    fn my_method(&self) { }

    #[route(skip)]
    fn internal_method(&self) { }

    #[route(hidden)]  // Hidden from OpenAPI but still routed
    fn secret(&self) { }
}