熟悉框架
This commit is contained in:
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