From 7cc91285a08a87a8987868a9e8e30d7a710dcaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Sat, 18 Oct 2025 20:50:04 +0200 Subject: [PATCH] axum web app --- src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e7a11a9..cc77045 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,14 @@ -fn main() { - println!("Hello, world!"); +use axum::{response::Html, routing::get, Router}; + +#[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("

Hello, World!

") }