Skip to content

Commit

Permalink
upgrade to Axum 0.7 (#1984)
Browse files Browse the repository at this point in the history
* refactor: upgrade to axum 0.7

* refactor: upgrade to axum 0.7
  • Loading branch information
ttys3 authored Nov 27, 2023
1 parent 09a1983 commit 3ff4f11
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
18 changes: 9 additions & 9 deletions examples/axum_example/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
9 changes: 4 additions & 5 deletions examples/axum_example/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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;
Expand Down Expand Up @@ -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(())
}
Expand Down
2 changes: 1 addition & 1 deletion examples/axum_example/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 3ff4f11

Please sign in to comment.