diff --git a/examples/axum_example/api/Cargo.toml b/examples/axum_example/api/Cargo.toml index de7462e48..bc82d122b 100644 --- a/examples/axum_example/api/Cargo.toml +++ b/examples/axum_example/api/Cargo.toml @@ -7,16 +7,16 @@ publish = false [dependencies] axum-example-service = { path = "../service" } -tokio = { version = "1.29.0", features = ["full"] } -axum = "0.6.19" +tokio = { version = "1.34.0", features = ["full"] } +axum = "0.7.1" tower = "0.4.13" -tower-http = { version = "0.4.3", features = ["fs"] } -tower-cookies = "0.9.0" -anyhow = "1.0.71" +tower-http = { version = "0.5.0", features = ["fs"] } +tower-cookies = "0.10.0" +anyhow = "1.0.75" dotenvy = "0.15.7" -serde = "1.0.175" -serde_json = "1.0.102" -tera = "1.17.1" -tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } +serde = "1.0.193" +serde_json = "1.0.108" +tera = "1.19.1" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } entity = { path = "../entity" } migration = { path = "../migration" } diff --git a/examples/axum_example/api/src/lib.rs b/examples/axum_example/api/src/lib.rs index 28a7572b9..4cf8d80e5 100644 --- a/examples/axum_example/api/src/lib.rs +++ b/examples/axum_example/api/src/lib.rs @@ -5,7 +5,7 @@ use axum::{ http::StatusCode, response::Html, routing::{get, get_service, post}, - Router, Server, + Router, }; use axum_example_service::{ sea_orm::{Database, DatabaseConnection}, @@ -15,8 +15,7 @@ use entity::post; use flash::{get_flash_cookie, post_response, PostResponse}; use migration::{Migrator, MigratorTrait}; use serde::{Deserialize, Serialize}; -use std::str::FromStr; -use std::{env, net::SocketAddr}; +use std::env; use tera::Tera; use tower_cookies::{CookieManagerLayer, Cookies}; use tower_http::services::ServeDir; @@ -63,8 +62,8 @@ async fn start() -> anyhow::Result<()> { .layer(CookieManagerLayer::new()) .with_state(state); - let addr = SocketAddr::from_str(&server_url).unwrap(); - Server::bind(&addr).serve(app.into_make_service()).await?; + let listener = tokio::net::TcpListener::bind(&server_url).await.unwrap(); + axum::serve(listener, app).await?; Ok(()) } diff --git a/examples/axum_example/service/Cargo.toml b/examples/axum_example/service/Cargo.toml index 0069d8d76..261b451b8 100644 --- a/examples/axum_example/service/Cargo.toml +++ b/examples/axum_example/service/Cargo.toml @@ -20,7 +20,7 @@ features = [ ] [dev-dependencies] -tokio = { version = "1.20.0", features = ["macros", "rt"] } +tokio = { version = "1.34.0", features = ["macros", "rt"] } [features] mock = ["sea-orm/mock"]