From ffdc1bdd9f104219c50c20316dded52e937541fe Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 12 Nov 2022 11:18:04 +0100 Subject: [PATCH] axum-server: Serve whole directory --- axum-server/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/axum-server/src/main.rs b/axum-server/src/main.rs index 31c0a4f..02b4700 100644 --- a/axum-server/src/main.rs +++ b/axum-server/src/main.rs @@ -47,8 +47,8 @@ async fn main() { tracing_subscriber::fmt::init(); let app = Router::new() .route("/hello/:name", get(hello)) - .route("/static", - get_service(tower_http::services::ServeFile::new("Cargo.toml").precompressed_gzip()) + .nest("/static", + get_service(tower_http::services::ServeDir::new(".").precompressed_gzip()) .handle_error(|e: io::Error| async move { (StatusCode::INTERNAL_SERVER_ERROR, format!("Unhandled internal error: {}", e)) }) -- 2.39.5