Macro static_router

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

Create a static files router with the given name and static directory path.

The static directory path is relative to the crate root, not the caller file.

The resulting router serves the static files at the root. Use axum’s router nesting feature if you want the static files to be scoped to something like /static.

§Syntax

The macro expects as arguments an identifier (the router name), then a comma, then a string literal (the static directory path).

§Examples

Create a router named router that serves the files in static.

static_router!(router, "static");