fix: update fallback service to serve index.html for not found routes

This commit is contained in:
itsscb 2025-03-04 23:42:48 +01:00
parent 7d85e5e4f6
commit 5610260120

View File

@ -1,10 +1,13 @@
use axum::Router;
use tower_http::services::ServeDir;
use tower_http::services::{ServeDir, ServeFile};
#[shuttle_runtime::main]
#[allow(clippy::unused_async)]
async fn main() -> shuttle_axum::ShuttleAxum {
let router = Router::new().fallback_service(ServeDir::new("frontend/dist/frontend/browser"));
let router = Router::new().fallback_service(
ServeDir::new("frontend/dist/frontend/browser")
.not_found_service(ServeFile::new("frontend/dist/frontend/browser/index.html")),
);
Ok(router.into())
}