Skip to main content

module

Attribute Macro module 

Source
#[module]
Expand description

Groups handlers under a shared URL prefix and optional middleware.

ยงSyntax

#[module(prefix = "/api/v1")]
#[module(prefix = "/api/v1", middleware = [auth_required, require_role("admin")])]
mod my_module { ... }

All #[handler] attributes inside the module are automatically rewritten to include module = "module_name" so they are grouped correctly at startup. The module is registered via inventory and collected by AppBuilder.