use crate::WebSite; use actix_web::{get, web, HttpResponse, Responder}; use std::path::PathBuf; #[get("/{pth:.*}")] pub async fn page(website: web::Data<WebSite>, pth: web::Path<PathBuf>) -> impl Responder { let pth = pth.into_inner(); match website.get_page_by_url(&pth) { Some(page) => HttpResponse::Ok().body(page.html.to_string()), None => HttpResponse::NotFound().body(format!("Not found {}", pth.display())), } }