Initial 404 page #13

This commit is contained in:
Mylloon 2023-02-08 22:27:40 +01:00
parent 9b75dbb7d2
commit 0612b09ca0
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 9 additions and 0 deletions

View file

@ -4,6 +4,9 @@ mod config;
#[path = "routes/index.rs"] #[path = "routes/index.rs"]
mod index; mod index;
#[path = "routes/not_found.rs"]
mod not_found;
#[path = "routes/agreements.rs"] #[path = "routes/agreements.rs"]
mod agreements; mod agreements;
@ -22,6 +25,7 @@ async fn main() -> std::io::Result<()> {
.service(agreements::humans) .service(agreements::humans)
.service(agreements::robots) .service(agreements::robots)
.service(agreements::sitemap) .service(agreements::sitemap)
.default_service(web::to(not_found::page))
}) })
.bind(addr)? .bind(addr)?
.run() .run()

5
src/routes/not_found.rs Normal file
View file

@ -0,0 +1,5 @@
use actix_web::{HttpResponse, Responder};
pub async fn page() -> impl Responder {
HttpResponse::NotFound().body("404 :/")
}