refactor: Used askama_axum::Template

docs: https://djc.github.io/askama/integrations.html#axum-integration
This commit is contained in:
Simon C
2024-08-10 16:59:36 +02:00
parent 69a2d11501
commit c3f97564d6
6 changed files with 26 additions and 35 deletions

View File

@ -3,8 +3,7 @@ mod templates;
use std::path::Path;
use askama::Template;
use askama_axum::IntoResponse;
use askama_axum::Template;
use axum::http::{StatusCode, Uri};
use tower_http::services::ServeDir;
@ -14,10 +13,10 @@ async fn fallback(uri: Uri) -> (StatusCode, String) {
#[derive(Template)]
#[template(path = "index.html")]
pub struct GetIndexResponse;
pub struct GetIndexTemplate;
async fn root() -> impl IntoResponse {
GetIndexResponse {}.into_response()
async fn root() -> GetIndexTemplate {
GetIndexTemplate {}
}
pub fn get_router(assets_path: &Path) -> axum::Router {