From 70842b1db2d7548040b83699a439dff864fd42e2 Mon Sep 17 00:00:00 2001 From: Matthew Gordon Date: Sat, 10 Feb 2024 12:57:20 -0400 Subject: [PATCH] Create stub Axum app --- Cargo.toml | 10 ++++++++++ src/main.rs | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..93fac06 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "localhub" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tokio = { version = "1", features = ["rt-multi-thread"]} +axum = "0.7" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..ee84d16 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,14 @@ +use axum::{routing::get, Router}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let app = Router::new().route("/", get(root)); + + let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?; + axum::serve(listener, app).await?; + Ok(()) +} + +async fn root() -> &'static str { + "It works!" +}