diff options
author | Guillermo Ramos | 2025-02-16 14:11:44 +0100 |
---|---|---|
committer | Guillermo Ramos | 2025-02-16 19:36:23 +0100 |
commit | 93e1545fb7da1f54fcc3dade596185ffe6c7a17d (patch) | |
tree | 0e8f5a4e30ed685f0aa297359f1bd453200f69b5 /src | |
parent | 472b540de459ade8ce8f9b16b97de06020dede30 (diff) | |
download | hiccup-93e1545fb7da1f54fcc3dade596185ffe6c7a17d.tar.gz |
Axum @ web.rs
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/cli.rs (renamed from src/main.rs) | 0 | ||||
-rw-r--r-- | src/bin/web.rs | 19 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/main.rs b/src/bin/cli.rs index 5ca388b..5ca388b 100644 --- a/src/main.rs +++ b/src/bin/cli.rs diff --git a/src/bin/web.rs b/src/bin/web.rs new file mode 100644 index 0000000..fed833b --- /dev/null +++ b/src/bin/web.rs @@ -0,0 +1,19 @@ +use axum::{ + response::Html, + routing::get, + Router, +}; + +async fn root_get() -> Html<&'static str> { + Html("<h1>Hello, world!</h1>") +} + +#[tokio::main] +async fn main() { + // build our application with a single route + let app = Router::new().route("/", get(root_get)); + + // run our app with hyper, listening globally on port 3000 + let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); + axum::serve(listener, app).await.unwrap(); +} |