From c1dc693e0d3e312d52160c312961bf47f1cffbf7 Mon Sep 17 00:00:00 2001 From: Utkarsh Kukreti Date: Thu, 30 Nov 2023 19:59:51 +0530 Subject: [PATCH] update axum to 0.7.1 in examples/axum --- examples/axum/Cargo.toml | 2 +- examples/axum/src/main.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/axum/Cargo.toml b/examples/axum/Cargo.toml index 8e40f7c..9b2d30f 100644 --- a/examples/axum/Cargo.toml +++ b/examples/axum/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -axum = "0.6.20" +axum = "0.7.1" markup = { path = "../../markup" } serde = { version = "1.0.192", features = ["derive"] } tokio = { version = "1.34.0", features = ["full"] } diff --git a/examples/axum/src/main.rs b/examples/axum/src/main.rs index 2757ab1..f0d8227 100644 --- a/examples/axum/src/main.rs +++ b/examples/axum/src/main.rs @@ -71,10 +71,11 @@ async fn post(form: axum::extract::Form) -> impl axum::response::IntoRe async fn main() { let app = axum::Router::new().route("/", axum::routing::get(get).post(post)); - eprintln!("starting on http://0.0.0.0:3000"); + let address = "0.0.0.0:3000"; - axum::Server::bind(&([0, 0, 0, 0], 3000).into()) - .serve(app.into_make_service()) - .await - .unwrap(); + eprintln!("starting on http://{}", address); + + let listener = tokio::net::TcpListener::bind(address).await.unwrap(); + + axum::serve(listener, app).await.unwrap(); }