axum web app

This commit is contained in:
Khaïs COLIN 2025-10-18 20:50:04 +02:00
parent 07205c41de
commit 7cc91285a0
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo

View file

@ -1,3 +1,14 @@
fn main() { use axum::{response::Html, routing::get, Router};
println!("Hello, world!");
#[tokio::main]
async fn main() {
let app = Router::new().route("/", get(handler));
let listener = tokio::net::TcpListener::bind("0.0.0.0:3001").await.unwrap();
println!("listening on {}", listener.local_addr().unwrap());
axum::serve(listener, app).await.unwrap();
}
async fn handler() -> Html<&'static str> {
Html("<h1>Hello, World!</h1>")
} }