mylloon.fr/src/routes/index.rs
Mylloon b0112c06d6
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
use to_owned instead of clone
2023-04-24 12:18:21 +02:00

22 lines
575 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().to_owned()))
}
#[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,
},
)
}