diff --git a/src/main.rs b/src/main.rs index d5f3ed5..ef01f2d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ async fn main() { let game = open_tavern::GameServer::new(); tokio::spawn(game.server_loop(mrecv, bsend)); + println!("Server is running at http://localhost:3001"); axum::serve(listener, app) .await .expect("axum server crashed, yaaaaay (unless i crashed him that yay)"); @@ -167,26 +168,26 @@ async fn handle_socket( println!("Done with so-cat"); } -async fn root() -> axum::response::Html<&'static str> { - response::Html(include_str!("../assets/web/index.html")) +async fn root() -> axum::response::Html { + response::Html(std::fs::read_to_string("./assets/web/index.html").expect("Failed finding index.html")) } async fn socket() -> impl response::IntoResponse { ( [(axum::http::header::CONTENT_TYPE, "text/javascript")], - include_str!("../assets/web/tavern.js"), + std::fs::read_to_string("./assets/web/tavern.js").expect("Failed finding tavern.js"), ) } async fn app_js() -> impl response::IntoResponse { ( [(axum::http::header::CONTENT_TYPE, "text/javascript")], - include_str!("../assets/web/app.js"), + std::fs::read_to_string("./assets/web/app.js").expect("Failed finding app.js"), ) } async fn style() -> impl response::IntoResponse { ( [(axum::http::header::CONTENT_TYPE, "text/css")], - include_str!("../assets/web/style.css"), + std::fs::read_to_string("./assets/web/style.css").unwrap(), ) }