| 1 | use crate::prelude::*; |
| 2 | |
| 3 | #[derive(Template)] |
| 4 | #[template(path = "about.html")] |
| 5 | struct About {} |
| 6 | |
| 7 | #[get("/about")] |
| 8 | pub async fn page() -> ActixResult<HttpResponse> { |
| 9 | let rendered = About {}.render(); |
| 10 | |
| 11 | match rendered { |
| 12 | Ok(html) => Ok(HttpResponse::Ok().content_type("text/html").body(html)), |
| 13 | Err(e) => Ok(HttpResponse::InternalServerError().body(e.to_string())), |
| 14 | } |
| 15 | } |
