Skip to content

Commit

Permalink
Merge pull request #703 from ttys3/axum_example_v0.5.4
Browse files Browse the repository at this point in the history
chore: update axum to 0.5.4 and fix up .env database name typo
  • Loading branch information
tyt2y3 authored May 9, 2022
2 parents 2794410 + 4b9eeec commit 30e7f42
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/axum_example/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HOST=127.0.0.1
PORT=8000
DATABASE_URL="postgres://root:root@localhost/axum_exmaple"
DATABASE_URL="postgres://root:root@localhost/axum_example"
22 changes: 11 additions & 11 deletions examples/axum_example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ publish = false
members = [".", "entity", "migration"]

[dependencies]
tokio = { version = "1.14", features = ["full"] }
axum = { version = "0.4.2" }
tower = "0.4.11"
tower-http = { version = "0.2", features = ["fs"] }
tower-cookies = { version = "0.4" }
anyhow = "1"
dotenv = "0.15"
serde = "1"
serde_json = "1"
tera = "1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tokio = { version = "1.18.1", features = ["full"] }
axum = "0.5.4"
tower = "0.4.12"
tower-http = { version = "0.3.3", features = ["fs"] }
tower-cookies = "0.6.0"
anyhow = "1.0.57"
dotenv = "0.15.0"
serde = "1.0.137"
serde_json = "1.0.81"
tera = "1.15.0"
tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }
entity = { path = "entity" }
migration = { path = "migration" }
6 changes: 3 additions & 3 deletions examples/axum_example/src/main.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},
AddExtensionLayer, Router, Server,
Router, Server,
};
use entity::post;
use entity::sea_orm;
Expand Down Expand Up @@ -61,8 +61,8 @@ async fn main() -> anyhow::Result<()> {
.layer(
ServiceBuilder::new()
.layer(CookieManagerLayer::new())
.layer(AddExtensionLayer::new(conn))
.layer(AddExtensionLayer::new(templates)),
.layer(Extension(conn))
.layer(Extension(templates)),
);

let addr = SocketAddr::from_str(&server_url).unwrap();
Expand Down

0 comments on commit 30e7f42

Please sign in to comment.