熟悉框架
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/target
|
||||
|
||||
*.code-workspace
|
||||
*.code-workspace
|
||||
.idea
|
||||
13
Cargo.lock
generated
13
Cargo.lock
generated
@@ -9,6 +9,7 @@ dependencies = [
|
||||
"axum",
|
||||
"sea-orm",
|
||||
"shaku",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
@@ -1859,6 +1860,15 @@ version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "2.2.0"
|
||||
@@ -2290,9 +2300,12 @@ version = "1.49.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.61.2",
|
||||
|
||||
@@ -12,4 +12,6 @@ shaku = "0.6.2"
|
||||
# WEB 框架
|
||||
axum = "0.8.8"
|
||||
# 持久层框架
|
||||
sea-orm = "2.0.0-rc.28"
|
||||
sea-orm = "2.0.0-rc.28"
|
||||
# 异步调度运行时
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
10
src/main.rs
10
src/main.rs
@@ -1,3 +1,9 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use axum::{ Router, routing::get, };
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let app = Router::new().route("/", get(|| async { "Hello, World!" }));
|
||||
let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 3000));
|
||||
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user