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 - + + +