mylloon.fr/src/routes/index.rs
2023-04-19 20:07:53 +02:00

26 lines
651 B
Rust

use actix_web::{get, web, HttpResponse, Responder};
use cached::proc_macro::once;
use ramhorns::Content;
use crate::{config::Config, template::Infos};
#[get("/")]
pub async fn page(config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(get_page(config.get_ref().clone()))
}
#[derive(Content)]
struct IndexTemplate {}
#[once(time = 60)]
pub fn get_page(config: Config) -> String {
config.tmpl.render(
"index.html",
IndexTemplate {},
Infos {
page_title: Some("Mylloon".to_string()),
page_desc: Some("Page principale".to_string()),
page_kw: None,
},
)
}