Skip to content

Commit 3779344

Browse files
committed
fixed 404 handler
1 parent 22c7458 commit 3779344

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

backend/src/handlers.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use rocket::catch;
2+
use rocket::response::NamedFile;
23

3-
use crate::responses::{bad_request, forbidden, internal_server_error, not_found, service_unavailable, unauthorized, APIResponse};
4+
use crate::responses::{bad_request, forbidden, internal_server_error, service_unavailable, unauthorized, APIResponse};
45

56
#[catch(400)]
67
pub fn bad_request_handler() -> APIResponse {
@@ -18,8 +19,8 @@ pub fn forbidden_handler() -> APIResponse {
1819
}
1920

2021
#[catch(404)]
21-
pub fn not_found_handler() -> APIResponse {
22-
not_found()
22+
pub fn not_found_handler() -> Option<NamedFile> {
23+
NamedFile::open("public/index.html").ok()
2324
}
2425

2526
#[catch(500)]

0 commit comments

Comments
 (0)