diff --git a/examples/axum_example/Cargo.toml b/examples/axum_example/Cargo.toml index 1a3336e2f..3b07ce6df 100644 --- a/examples/axum_example/Cargo.toml +++ b/examples/axum_example/Cargo.toml @@ -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" @@ -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"] \ No newline at end of file +sqlx-postgres = ["sea-orm/sqlx-postgres"] diff --git a/examples/axum_example/src/main.rs b/examples/axum_example/src/main.rs index 7b0b428e0..5c48d9dc3 100644 --- a/examples/axum_example/src/main.rs +++ b/examples/axum_example/src/main.rs @@ -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}; @@ -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),