diff options
Diffstat (limited to 'src/routes.rs')
-rw-r--r-- | src/routes.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/routes.rs b/src/routes.rs index 651626a..0df3470 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -3,13 +3,16 @@ | |||
3 | use crate::custom_filters; | 3 | use crate::custom_filters; |
4 | use crate::handlers; | 4 | use crate::handlers; |
5 | use crate::Db; | 5 | use crate::Db; |
6 | use warp::{Filter, filters::BoxedFilter, Rejection, Reply}; | 6 | use log::info; |
7 | use log::{info}; | 7 | use warp::{filters::BoxedFilter, Filter, Rejection, Reply}; |
8 | 8 | ||
9 | /// Every route combined for a single network | 9 | /// Every route combined for a single network |
10 | pub fn network(db: Db) -> BoxedFilter<(impl Reply,)> { | 10 | pub fn network(db: Db) -> BoxedFilter<(impl Reply,)> { |
11 | let url_prefix = db.config.url_prefix.clone(); | 11 | let url_prefix = db.config.url_prefix.clone(); |
12 | info!("{} will be served at endpoint /{}", db.config.name, url_prefix); | 12 | info!( |
13 | "{} will be served at endpoint /{}", | ||
14 | db.config.name, url_prefix | ||
15 | ); | ||
13 | let root = if url_prefix.is_empty() { | 16 | let root = if url_prefix.is_empty() { |
14 | // warp::path does not like empty url_prefix | 17 | // warp::path does not like empty url_prefix |
15 | // We need to handle this case separately | 18 | // We need to handle this case separately |
@@ -19,14 +22,14 @@ pub fn network(db: Db) -> BoxedFilter<(impl Reply,)> { | |||
19 | }; | 22 | }; |
20 | root.and( | 23 | root.and( |
21 | transaction_list(db.clone()) | 24 | transaction_list(db.clone()) |
22 | .or(get_config_route(db.clone())) | 25 | .or(get_config_route(db.clone())) |
23 | .or(register_user(db.clone())) | 26 | .or(register_user(db.clone())) |
24 | .or(auth_transaction_propose(db.clone())) | 27 | .or(auth_transaction_propose(db.clone())) |
25 | .or(auth_block_propose(db.clone())) | 28 | .or(auth_block_propose(db.clone())) |
26 | .or(list_users(db.clone())) | 29 | .or(list_users(db.clone())) |
27 | .or(block_list(db)) | 30 | .or(block_list(db)), |
28 | ) | 31 | ) |
29 | .boxed() | 32 | .boxed() |
30 | } | 33 | } |
31 | 34 | ||
32 | /// GET /config warp route | 35 | /// GET /config warp route |