axum-impl-static-files
Installation
SKILL.md
axum-impl-static-files
Overview
Axum itself has no static file API. Static file serving is provided by the
tower-http crate through two types: ServeDir (serves a directory) and
ServeFile (serves one file). Both are tower::Service implementations, NOT
tower::Layer implementations.
This single fact governs the whole topic: a Service is a route TARGET and is
mounted with .nest_service(), .fallback_service(), or .route_service(). It
is NEVER passed to .layer(). The confusion is common because other tower-http
items (TraceLayer, CompressionLayer) ARE layers.
Static file serving is identical between Axum 0.7 and 0.8, because the code lives
in tower-http, not in Axum. There are no version-divergent snippets in this
skill.