From 0612b09ca0b8e34c0534ff09360d2769465a193e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 8 Feb 2023 22:27:40 +0100 Subject: [PATCH] Initial 404 page #13 --- src/main.rs | 4 ++++ src/routes/not_found.rs | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 src/routes/not_found.rs diff --git a/src/main.rs b/src/main.rs index 42754c9..4d1632c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,9 @@ mod config; #[path = "routes/index.rs"] mod index; +#[path = "routes/not_found.rs"] +mod not_found; + #[path = "routes/agreements.rs"] mod agreements; @@ -22,6 +25,7 @@ async fn main() -> std::io::Result<()> { .service(agreements::humans) .service(agreements::robots) .service(agreements::sitemap) + .default_service(web::to(not_found::page)) }) .bind(addr)? .run() diff --git a/src/routes/not_found.rs b/src/routes/not_found.rs new file mode 100644 index 0000000..462b8c7 --- /dev/null +++ b/src/routes/not_found.rs @@ -0,0 +1,5 @@ +use actix_web::{HttpResponse, Responder}; + +pub async fn page() -> impl Responder { + HttpResponse::NotFound().body("404 :/") +}