From e3520be75b6231d26d4d68ac5f8581bd32dc3982 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sat, 6 May 2023 00:34:56 -0500 Subject: [PATCH] fix: Handle most wrong routes --- actix/src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/actix/src/main.rs b/actix/src/main.rs index 3553421..06772da 100644 --- a/actix/src/main.rs +++ b/actix/src/main.rs @@ -58,7 +58,6 @@ async fn siteurl(session: Session) -> HttpResponse { } // 404 error page -#[get("/err/404")] async fn error404() -> impl Responder { NamedFile::open_async("./resources/static/404.html") .await @@ -139,13 +138,13 @@ async fn main() -> std::io::Result<()> { .wrap(middleware::Logger::default()) .wrap(middleware::Compress::default()) .service(link_handler) - .service(error404) .service(getall) .service(siteurl) .service(add_link) .service(delete_link) .service(login) - .default_service(Files::new("/", "./resources/").index_file("index.html")) + .service(Files::new("/", "./resources/").index_file("index.html")) + .default_service(web::get().to(error404)) }) .bind(("0.0.0.0", port))? .run()