chore: Initialize Axum as webserver

This commit is contained in:
Florian Briand 2024-07-03 16:40:36 +02:00
parent 77f520a1a3
commit 677740c28c
Signed by: florian_briand
GPG Key ID: CC981B9E6B98E70B
2 changed files with 21 additions and 0 deletions

8
Cargo.toml Normal file
View File

@ -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"] }

13
src/main.rs Normal file
View File

@ -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();
}