mylloon.fr/src/routes/index.rs

18 lines
358 B
Rust
Raw Normal View History

2023-02-08 20:49:05 +01:00
use actix_web::{get, HttpResponse, Responder};
2023-02-08 22:14:57 +01:00
use askama::Template;
2023-02-08 20:49:05 +01:00
2023-02-09 11:19:53 +01:00
use crate::template::render_html;
2023-02-08 20:49:05 +01:00
#[get("/")]
pub async fn page() -> impl Responder {
2023-02-09 10:57:18 +01:00
HttpResponse::Ok().body(get_page())
2023-02-08 20:49:05 +01:00
}
2023-02-08 22:14:57 +01:00
#[derive(Template)]
2023-04-09 16:51:50 +02:00
#[template(path = "index.html")]
2023-02-09 10:45:59 +01:00
struct IndexTemplate {}
2023-02-08 22:14:57 +01:00
2023-02-09 10:57:18 +01:00
pub fn get_page() -> std::string::String {
2023-02-09 11:19:53 +01:00
render_html(&IndexTemplate {})
2023-02-08 22:14:57 +01:00
}