Skip to content

Commit

Permalink
feat: Add 404 page and route
Browse files Browse the repository at this point in the history
  • Loading branch information
ikurotime committed Jan 5, 2024
1 parent 0a7bff5 commit e32886f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/routes/web_routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ pub fn get_routes() -> Router {
.route("/another_page", get(get_another_page))
.route("/register", get(get_register))
.route("/login", get(get_login))
.route("/404", get(get_not_found))
}
async fn get_not_found() -> impl IntoResponse {
let template = NotFoundPageTemplate {};
HtmlTemplate(template)
}

#[derive(Template)]
#[template(path = "pages/404.html")]
struct NotFoundPageTemplate;

async fn get_login() -> impl IntoResponse {
let template = LoginPageTemplate {};
Expand Down
6 changes: 6 additions & 0 deletions templates/pages/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- prettier-ignore -->
{% extends "layouts/base.html" %}
{% block title %}Hello!{% endblock %}
{% block content %}
<h1>The requested page does not exists</h1>
{% endblock %}

0 comments on commit e32886f

Please sign in to comment.