Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to Axum 0.7 #1984

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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