Add Backend

This commit is contained in:
BloxerHD 2026-06-23 17:17:57 +01:00
commit 05beab587b
Signed by: bloxerhd018
SSH key fingerprint: SHA256:ItSfcfhpXlfkMK3uQSDYW5X3XKm0hbHWQqWcCK57px8
31 changed files with 59 additions and 6 deletions

25
src/main.rs Normal file
View file

@ -0,0 +1,25 @@
use std::env;
use axum::Router;
use tower_http::services::ServeDir;
use dotenvy::dotenv;
#[tokio::main]
async fn main() {
dotenv().ok();
let host = env::var("APP_HOST").unwrap_or("0.0.0.0".into());
let port = env::var("APP_PORT").unwrap_or("80".into());
let app = Router::new()
.fallback_service(ServeDir::new("static"));
let listener = tokio::net::TcpListener::bind(format!("{}:{}", host, port))
.await
.unwrap();
println!("Website Hosting with Host {} and Port {}", host, port);
axum::serve(listener, app)
.await
.unwrap();
}