404 page
This commit is contained in:
@@ -7,9 +7,24 @@ mod subscriptions;
|
||||
mod subscriptions_confirm;
|
||||
|
||||
pub use admin::*;
|
||||
use askama::Template;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
pub use health_check::*;
|
||||
pub use home::*;
|
||||
pub use login::*;
|
||||
pub use posts::*;
|
||||
use reqwest::StatusCode;
|
||||
pub use subscriptions::*;
|
||||
pub use subscriptions_confirm::*;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "../templates/404.html")]
|
||||
struct NotFoundTemplate;
|
||||
|
||||
pub async fn not_found() -> Response {
|
||||
(
|
||||
StatusCode::NOT_FOUND,
|
||||
Html(NotFoundTemplate.render().unwrap()),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
|
||||
@@ -150,5 +150,6 @@ pub fn app(
|
||||
}),
|
||||
)
|
||||
.layer(SessionManagerLayer::new(redis_store).with_secure(false))
|
||||
.fallback(not_found)
|
||||
.with_state(app_state)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user