From 880bab0ae26a2b9cafacf942dc1f4bcf6e260e15 Mon Sep 17 00:00:00 2001 From: Adam <24621027+adoyle0@users.noreply.github.com> Date: Sat, 4 May 2024 03:52:53 -0400 Subject: [PATCH] docs --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 730c13f..8e1e704 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,17 +86,17 @@ pub struct AppState { games: Mutex>, } -// Include utf-8 file at **compile** time. +// Include utf-8 files at **compile** time. async fn index() -> Html<&'static str> { Html(std::include_str!("../test_client.html")) } - async fn spawnclients() -> Html<&'static str> { Html(std::include_str!("../spawnclients.html")) } #[tokio::main] async fn main() -> Result<(), Box> { + // stuff for logging tracing_subscriber::registry() .with( tracing_subscriber::EnvFilter::try_from_default_env() @@ -118,12 +118,14 @@ async fn main() -> Result<(), Box> { games, }); + // set routes and apply state let app = Router::new() .route("/", get(index)) .route("/test", get(spawnclients)) .route("/websocket", get(websocket_handler)) .with_state(app_state); + // send it let listener = tokio::net::TcpListener::bind("0.0.0.0:3030").await?; tracing::debug!("listening on {}", listener.local_addr()?); axum::serve(