mylloon.fr/src/routes/index.rs
2023-04-21 19:47:41 +02:00

22 lines
572 B
Rust

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