熟悉框架

This commit is contained in:
des
2026-01-24 08:15:26 +08:00
parent 5bec831190
commit 56aa9c0579
4 changed files with 26 additions and 4 deletions

View File

@@ -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();
}