diff options
author | Yigit Sever | 2022-04-17 02:31:43 +0300 |
---|---|---|
committer | Yigit Sever | 2022-04-17 02:31:43 +0300 |
commit | c845a4679c492fe61744d7b54e64ff78fb8beb93 (patch) | |
tree | 9aa1de8b5f2ab30281eca7266561e15d0d708591 /src | |
parent | b7bd1c0a4d4903c54a2f6bd758737f613d216d70 (diff) | |
download | gradecoin-c845a4679c492fe61744d7b54e64ff78fb8beb93.tar.gz gradecoin-c845a4679c492fe61744d7b54e64ff78fb8beb93.tar.bz2 gradecoin-c845a4679c492fe61744d7b54e64ff78fb8beb93.zip |
Add 404 support
Diffstat (limited to 'src')
-rw-r--r-- | src/routes.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/routes.rs b/src/routes.rs index 4dd22bc..c0ccd26 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -1,14 +1,15 @@ | |||
1 | //! # Endpoints and their construction | 1 | //! # Endpoints and their construction |
2 | // | 2 | // |
3 | use warp::{Filter, Rejection, Reply}; | ||
4 | use crate::custom_filters; | 3 | use crate::custom_filters; |
5 | use crate::handlers; | 4 | use crate::handlers; |
6 | use crate::Db; | 5 | use crate::Db; |
6 | use warp::{Filter, Rejection, Reply}; | ||
7 | 7 | ||
8 | /// Every route combined | 8 | /// Every route combined |
9 | pub fn application(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { | 9 | pub fn application(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { |
10 | // gradecoin-site (zola) outputs a public/, we serve it here | 10 | // gradecoin-site (zola) outputs a public/, we serve it here |
11 | let static_route = warp::any().and(warp::fs::dir("public")); | 11 | let static_route = warp::any().and(warp::fs::dir("public")); |
12 | let error_page = warp::any().and(warp::fs::file("public/404.html")); | ||
12 | 13 | ||
13 | transaction_list(db.clone()) | 14 | transaction_list(db.clone()) |
14 | .or(register_user(db.clone())) | 15 | .or(register_user(db.clone())) |
@@ -17,6 +18,7 @@ pub fn application(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejectio | |||
17 | .or(list_users(db.clone())) | 18 | .or(list_users(db.clone())) |
18 | .or(block_list(db)) | 19 | .or(block_list(db)) |
19 | .or(static_route) | 20 | .or(static_route) |
21 | .or(error_page) | ||
20 | } | 22 | } |
21 | 23 | ||
22 | /// GET /user warp route | 24 | /// GET /user warp route |