This commit is contained in:
2026-03-15 19:02:21 +01:00
commit c061763538
6 changed files with 150 additions and 0 deletions

26
src/main.rs Normal file
View File

@@ -0,0 +1,26 @@
mod server;
mod router;
mod response;
use std::path::PathBuf;
use std::sync::Arc;
use logger_rust::*;
fn main() {
let args: Vec<String> = std::env::args().collect();
let port: u16 = args.get(1)
.and_then(|p| p.parse().ok())
.unwrap_or(8080);
let root = Arc::new(
PathBuf::from(args.get(2).map(|s| s.as_str()).unwrap_or("."))
);
if !root.exists() || !root.is_dir() {
log_error!("Root {} isnt a valid directory", root.display());
std::process::exit(1);
}
server::run(root, port);
}