Merge pull request #383 from ttys3/axum_example_v0.4.2
Axum example: update to Axum v0.4.2
This commit is contained in:
commit
4bcc8a24a2
@ -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"]
|
||||
sqlx-postgres = ["sea-orm/sqlx-postgres"]
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user