added a static directory

This commit is contained in:
2026-05-31 19:46:05 +01:00
parent 8352b9c7fd
commit 9a581ed5fc
5 changed files with 172 additions and 2 deletions
+3 -2
View File
@@ -24,6 +24,7 @@ use tokio::
sync::{Mutex, mpsc},
time::{Duration, sleep},
};
use tower_http::services::ServeDir;
use futures::StreamExt as _;
use rand::random_bool;
use serde::{Deserialize, Serialize, de};
@@ -130,11 +131,11 @@ async fn main() -> anyhow::Result<()>
});
}
let static_files = ServeDir::new("./static");
let app = Router::new()
.route("/", get(index))
.fallback_service(static_files)
.route("/ws", get(ws_handler))
.route("/ws-leaderboard", get(leaderboard_handler))
.route("/leaderboard", get(leaderboard))
.with_state
(AppState {
tx,