Skip to content

Commit

Permalink
Merge pull request #383 from ttys3/axum_example_v0.4.2
Browse files Browse the repository at this point in the history
Axum example: update to Axum v0.4.2
  • Loading branch information
tyt2y3 committed Dec 15, 2021
2 parents f5f6a67 + 951e678 commit 4bcc8a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
14 changes: 7 additions & 7 deletions examples/axum_example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ publish = false
[workspace]

[dependencies]
tokio = { version = "1.5", features = ["full"] }
axum = { version = "0.3.0" }
tower = "0.4.10"
tower-http = { version = "0.1", features = ["fs"] }
tower-cookies = { version = "0.3" }
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"
env_logger = "0.9"
Expand All @@ -23,11 +23,11 @@ tera = "1"

[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.4.0"
version = "^0.4.2"
features = ["macros", "runtime-tokio-native-tls"]
default-features = false

[features]
default = ["sqlx-postgres"]
sqlx-mysql = ["sea-orm/sqlx-mysql"]
sqlx-postgres = ["sea-orm/sqlx-postgres"]
sqlx-postgres = ["sea-orm/sqlx-postgres"]
7 changes: 3 additions & 4 deletions examples/axum_example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ mod post;
mod setup;

use axum::{
error_handling::HandleErrorExt,
extract::{Extension, Form, Path, Query},
http::StatusCode,
response::Html,
routing::{get, post, service_method_routing},
routing::{get, post, get_service},
AddExtensionLayer, Router, Server,
};
use flash::{get_flash_cookie, post_response, PostResponse};
Expand Down Expand Up @@ -47,11 +46,11 @@ async fn main() -> anyhow::Result<()> {
.route("/delete/:id", post(delete_post))
.nest(
"/static",
service_method_routing::get(ServeDir::new(concat!(
get_service(ServeDir::new(concat!(
env!("CARGO_MANIFEST_DIR"),
"/static"
)))
.handle_error(|error: std::io::Error| {
.handle_error(|error: std::io::Error| async move {
(
StatusCode::INTERNAL_SERVER_ERROR,
format!("Unhandled internal error: {}", error),
Expand Down

0 comments on commit 4bcc8a2

Please sign in to comment.