use std::fs; pub fn get_route_data(route: &str) -> String { match route { "/" => { return fs::read_to_string("./public/index.html").unwrap(); }, "/about" => { return fs::read_to_string("./public/pages/about.html").unwrap(); } _ if route.contains("assets") => { let mut public_route: String = "./public".to_string(); public_route.push_str(&route); return fs::read_to_string(&public_route).unwrap() }, &_ => { return fs::read_to_string("./public/404.html").unwrap(); } } } // pub fn path_exists(path: &str) -> bool { // fs::metadata(path).is_ok() // }