mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 08:57:54 +00:00
404 route
This commit is contained in:
1 parent
1979d604b0
commit
6a04f03f32
3 files changed
+13
No files matched your search
@@ -0,0 +1,10 @@
|
||||
use actix_http::http::StatusCode;
|
||||
use actix_web::{HttpResponse, HttpRequest, Responder, get};
|
||||
use log::warn;
|
||||
|
||||
pub async fn default_route_404() -> impl Responder {
|
||||
warn!("404 not found");
|
||||
HttpResponse::NotFound()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body("<h1>nope</h1>")
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod default_route_404;
|
||||
pub mod root_index;
|
||||
pub mod users;
|
||||
@@ -29,6 +29,7 @@ use crate::endpoints::users::logout::logout_handler;
|
||||
use crate::util::session_checker::SessionChecker;
|
||||
use crate::endpoints::users::session_info::session_info_handler;
|
||||
use crate::endpoints::root_index::get_root_index;
|
||||
use crate::endpoints::default_route_404::default_route_404;
|
||||
|
||||
const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345";
|
||||
const DEFAULT_RUST_LOG: &'static str = "debug,actix_web=info";
|
||||
@@ -158,6 +159,7 @@ pub async fn serve(server_state: ServerState) -> AnyhowResult<()>
|
||||
.route(web::head().to(|| HttpResponse::Ok()))
|
||||
)
|
||||
.service(get_root_index)
|
||||
.default_service( web::route().to(default_route_404))
|
||||
})
|
||||
.bind(bind_address)?
|
||||
.workers(num_workers)
|
||||
|
||||
Reference in new issue
Block a user