From f19a4b36dec9080798adc8e7ff09f53167e65cec Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Fri, 14 May 2021 10:23:12 +0200 Subject: [PATCH] Default the web server to returning index.html --- src/infra/tcp_server.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/infra/tcp_server.rs b/src/infra/tcp_server.rs index f84d135..5d8861b 100644 --- a/src/infra/tcp_server.rs +++ b/src/infra/tcp_server.rs @@ -192,7 +192,9 @@ where .configure(api_config::), ) // Serve the /pkg path with the compiled WASM app. - .service(Files::new("/pkg", "./app/pkg")); + .service(Files::new("/pkg", "./app/pkg")) + // Default to serve index.html for unknown routes, to support routing. + .service(web::scope("/").route("/.*", web::get().to(index))); } struct AppState