diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/routes.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/routes.rs b/src/routes.rs index 60e4ffa..9afe0ac 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -8,14 +8,20 @@ use warp::{Filter, filters::BoxedFilter, Rejection, Reply}; | |||
8 | /// Every route combined for a single network | 8 | /// Every route combined for a single network |
9 | pub fn network(db: Db) -> BoxedFilter<(impl Reply,)> { | 9 | pub fn network(db: Db) -> BoxedFilter<(impl Reply,)> { |
10 | let url_prefix = db.config.url_prefix.clone(); | 10 | let url_prefix = db.config.url_prefix.clone(); |
11 | warp::path(url_prefix) | 11 | let root = if url_prefix.is_empty() { |
12 | .and( | 12 | // warp::path does not like empty url_prefix |
13 | transaction_list(db.clone()) | 13 | // We need to handle this case separately |
14 | .or(register_user(db.clone())) | 14 | warp::any().boxed() |
15 | .or(auth_transaction_propose(db.clone())) | 15 | } else { |
16 | .or(auth_block_propose(db.clone())) | 16 | warp::path(url_prefix).boxed() |
17 | .or(list_users(db.clone())) | 17 | }; |
18 | .or(block_list(db)) | 18 | root.and( |
19 | transaction_list(db.clone()) | ||
20 | .or(register_user(db.clone())) | ||
21 | .or(auth_transaction_propose(db.clone())) | ||
22 | .or(auth_block_propose(db.clone())) | ||
23 | .or(list_users(db.clone())) | ||
24 | .or(block_list(db)) | ||
19 | ) | 25 | ) |
20 | .boxed() | 26 | .boxed() |
21 | } | 27 | } |