use http::handling::{methods::Method, routes::{Route, Data}, request::Request, response::{Response, Outcome, Status}, file_handlers::NamedFile}; fn index_handler(_request: Request, _data: Data) -> Outcome<Response, Status, Data> { Outcome::Success(Response { headers: vec![], cookies: None, status: None, body: Box::new(index()) }) } fn index() -> NamedFile { NamedFile::open("templates/index.html".into()).unwrap() } #[tokio::main] async fn main() { let index_route = Route { format: None, handler: index_handler, name: Some("Index"), uri: "", method: Method::Get, rank: 0, }; // http::build("127.0.0.1:8000") http::build("127.0.0.1:8443", "127.0.0.1:8080") .await .mount("/", vec![index_route]) .launch() .await; }