From 903a1de933c34d06c3de0ce8cbd6f63c845e3e71 Mon Sep 17 00:00:00 2001 From: M1n-0 Date: Tue, 31 Mar 2026 14:31:40 +0200 Subject: [PATCH] add route /game in backend --- backend/src/main.rs | 8 ++++++++ web/templates/view/index.html | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/src/main.rs b/backend/src/main.rs index 173236b..476046b 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -9,6 +9,7 @@ use tower_http::services::ServeDir; async fn main() { let app = Router::new() .route("/", get(handler)) + .route("/game", get(game)) .nest_service("/web/assets", ServeDir::new("../web/assets")); let addr = SocketAddr::from(([0, 0, 0, 0], 3500)); @@ -26,6 +27,13 @@ async fn handler() -> Html { Html(html_content) } +async fn game() -> Html { + let html_content = read_html_from_file("../web/templates/view/game.html") + .await + .unwrap_or_else(|_| "

Error loading HTML file

".to_string()); + Html(html_content) +} + async fn read_html_from_file>(path: P) -> io::Result { let mut file = File::open(path).await?; let mut contents = String::new(); diff --git a/web/templates/view/index.html b/web/templates/view/index.html index 182bf05..757299e 100644 --- a/web/templates/view/index.html +++ b/web/templates/view/index.html @@ -14,11 +14,13 @@

MirrorGame

MirrorGame - + + +