refactor: Used askama_axum::Template
docs: https://djc.github.io/askama/integrations.html#axum-integration
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user