Crate axum_static

Crate axum_static 

Source
Expand description

§axum_static

Static file serving for Axum.

This crate provides utilities for serving static files with proper content-type inference.

§Features

  • handle_error: Enables error handling for IO errors when serving files.
  • mime_guess: Uses the mime_guess crate for exhaustive MIME inference.
  • status_code: Enhances error responses with human-readable status messages.

§Example

use axum_static::static_router;

let app = static_router("static/");

Functions§

content_type_middleware
Middleware that sets the Content-Type header based on the file extension.
static_router
Creates a router that serves static files from the given directory.