2024-07-23 20:08:45 +02:00
|
|
|
use askama::Template;
|
2024-08-04 18:34:42 +02:00
|
|
|
use askama_axum::IntoResponse;
|
|
|
|
use axum::{routing, Router};
|
2024-07-23 20:08:45 +02:00
|
|
|
|
|
|
|
#[derive(Template)]
|
|
|
|
#[template(path = "hello.html")]
|
2024-08-04 18:34:42 +02:00
|
|
|
struct HelloResponse {
|
2024-07-23 20:08:45 +02:00
|
|
|
pub name: String,
|
|
|
|
}
|
2024-08-04 18:34:42 +02:00
|
|
|
|
|
|
|
async fn hello() -> impl IntoResponse {
|
|
|
|
HelloResponse {
|
|
|
|
name: "Theo".to_string(),
|
|
|
|
}.into_response()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_routes() -> Router {
|
|
|
|
Router::new()
|
|
|
|
.route("/", routing::get(hello))
|
|
|
|
}
|