Add Base Path

This commit is contained in:
gabatxo1312 2026-01-31 00:05:53 +01:00
commit f6d4e7c556
No known key found for this signature in database
9 changed files with 98 additions and 21 deletions

View file

@ -2,11 +2,12 @@ use askama::Template;
use askama_web::WebTemplate;
use axum::{
Router,
extract::State,
routing::{get, post},
};
use static_serve::embed_assets;
use crate::state::AppState;
use crate::{routes::template_ctx::TemplateCtx, state::AppState};
mod migrations;
mod models;
@ -44,8 +45,14 @@ pub fn build_app(state: AppState) -> Router {
#[derive(Template, WebTemplate)]
#[template(path = "404.html")]
struct NotFoundTemplate {}
pub async fn error_handler() -> impl axum::response::IntoResponse {
NotFoundTemplate {}
struct NotFoundTemplate {
pub ctx: TemplateCtx,
}
pub async fn error_handler(State(state): State<AppState>) -> impl axum::response::IntoResponse {
NotFoundTemplate {
ctx: TemplateCtx {
base_path: state.config.base_path,
},
}
}