docs
This commit is contained in:
parent
a131b16538
commit
880bab0ae2
1 changed files with 4 additions and 2 deletions
|
@ -86,17 +86,17 @@ pub struct AppState {
|
|||
games: Mutex<Vec<CAHGame>>,
|
||||
}
|
||||
|
||||
// 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<dyn Error>> {
|
||||
// stuff for logging
|
||||
tracing_subscriber::registry()
|
||||
.with(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||
|
@ -118,12 +118,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
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(
|
||||
|
|
Loading…
Add table
Reference in a new issue