Krys4lide/crates/app/src/main.rs

18 lines
563 B
Rust
Raw Normal View History

use ::app::get_router;
2024-07-25 09:21:17 +02:00
use std::env;
use std::path::Path;
#[tokio::main]
async fn main() {
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let assets_path = Path::new(&manifest_dir).join("assets");
let router = get_router(assets_path.as_path());
// TODO: select port based on available port (or ask in CLI)
2024-08-08 15:01:28 +02:00
let listener = tokio::net::TcpListener::bind("localhost:3000")
.await
.unwrap();
2024-08-02 23:33:48 +02:00
println!("Listening on: http://{}", listener.local_addr().unwrap());
axum::serve(listener, router).await.unwrap();
}