refactor: 更新依赖版本并优化axum服务器启动方式

升级所有依赖到最新版本,包括axum 0.8.4和sea-orm 1.1.17
修改axum服务器启动方式以兼容新版本API
将Rust edition更新至2024
添加.DS_Store到.gitignore
This commit is contained in:
2025-10-23 20:44:27 +08:00
parent d67ab615ce
commit 3185c3e7fa
6 changed files with 690 additions and 457 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored
View File

@ -16,3 +16,5 @@ target/
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
frontend/.DS_Store
.DS_Store

1124
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,30 @@
[package] [package]
name = "qiandao" name = "qiandao"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2024"
default-run = "qiandao" default-run = "qiandao"
[dependencies] [dependencies]
axum = { version = "0.6", features = ["multipart"] } axum = { version = "0.8.4", features = ["multipart"] }
tokio = { version = "1.0", features = ["full"] } tokio = { version = "1.0", features = ["full"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "mysql", "chrono", "uuid"] } sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "mysql", "chrono", "uuid"] }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
uuid = { version = "1.0", features = ["v4", "serde"] } uuid = { version = "1.0", features = ["v4", "serde"] }
tower-http = { version = "0.4", features = ["cors", "trace", "fs"] } tower-http = { version = "0.6.6", features = ["cors", "trace", "fs"] }
dotenv = "0.15" dotenv = "0.15"
tracing = "0.1" tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] }
bcrypt = "0.14" bcrypt = "0.17.1"
jsonwebtoken = "8.3" jsonwebtoken = "8.3"
calamine = "0.22" calamine = "0.22"
xlsxwriter = "0.6" xlsxwriter = "0.6"
rust_xlsxwriter = "0.78.0" rust_xlsxwriter = "0.78.0"
tower = { version = "0.4", features = ["util"] } tower = { version = "0.5.2", features = ["util"] }
bytes = "1.0" bytes = "1.0"
futures = "0.3" futures = "0.3"
[dependencies.sea-orm] [dependencies.sea-orm]
version = "0.11" version = "1.1.17"
features = ["sqlx-mysql", "runtime-tokio-rustls", "macros"] features = ["sqlx-mysql", "runtime-tokio-rustls", "macros"]

BIN
frontend/.DS_Store vendored

Binary file not shown.

View File

@ -47,10 +47,9 @@ async fn main() {
let addr = env::var("SERVER_ADDR").unwrap_or("127.0.0.1:3001".to_string()); let addr = env::var("SERVER_ADDR").unwrap_or("127.0.0.1:3001".to_string());
let socket_addr: SocketAddr = addr.parse().expect("Invalid server address"); let socket_addr: SocketAddr = addr.parse().expect("Invalid server address");
tracing::info!("Server running on {}", socket_addr); tracing::info!("Server running on {}", socket_addr);
axum::Server::bind(&socket_addr) // 兼容 axum >= 0.7 的启动方式
.serve(app.into_make_service()) let listener = tokio::net::TcpListener::bind(socket_addr).await.unwrap();
.await axum::serve(listener, app).await.unwrap();
.unwrap();
} }
async fn root() -> &'static str { async fn root() -> &'static str {