use crate::socket::{HttpRequestType, HttpResCode}; use super::App; pub struct IndexApp; impl App for IndexApp { fn socket_name(&self) -> &'static str { "index" } async fn handle_request<'a>( &'a mut self, path: &str, _req_type: HttpRequestType, _content: &str, ) -> (HttpResCode, &'static str, &'a [u8]) { match path { "/" | "/index" | "/index.html" => { (HttpResCode::Ok, "html", include_bytes!("./index.html")) } _ => (HttpResCode::NotFound, "", &[]), } } }