mylloon.fr/src/routes/index.rs

20 lines
405 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
#[get("/")]
pub async fn page() -> impl Responder {
HttpResponse::Ok().body(get_index())
}
2023-02-08 22:14:57 +01:00
#[derive(Template)]
#[template(path = "../templates/index.html")]
struct IndexTemplate<'a> {
name: &'a str,
}
pub fn get_index() -> std::string::String {
2023-02-08 22:29:21 +01:00
let index = IndexTemplate { name: "world" };
2023-02-08 22:14:57 +01:00
index.render().unwrap()
}