Macro folder_router

Source
folder_router!() { /* proc-macro */ }
Expand description

Creates an Axum router by scanning a directory for route.rs files.

§Parameters

  • path - A string literal pointing to the API directory, relative to the Cargo manifest directory
  • state_type - The type name of your application state that will be shared across all routes

§Example

let router = folder_router!("./src/api", AppState);

This will scan all route.rs files in the ./src/api directory and its subdirectories, automatically mapping their path structure to URL routes with the specified state type.