From 677740c28c4f5d06fdf240a8e714261f7a96b2a5 Mon Sep 17 00:00:00 2001 From: Florian Briand Date: Wed, 3 Jul 2024 16:40:36 +0200 Subject: [PATCH] chore: Initialize Axum as webserver --- Cargo.toml | 8 ++++++++ src/main.rs | 13 +++++++++++++ 2 files changed, 21 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..a4443e2 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "krys4lide" +version = "0.1.0" +edition = "2021" + +[dependencies] +axum = "0.7.5" +tokio = { version = "1.38.0", features = ["full"] } diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..740b768 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,13 @@ +use axum::{ + routing::get, + Router, +}; + +#[tokio::main] +async fn main() { + let app = Router::new() + .route("/", get(|| async { "Hello, World!" })); + + let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); + axum::serve(listener, app).await.unwrap(); +}