aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes.rs
diff options
context:
space:
mode:
authorYigit Sever2022-04-23 20:29:36 +0300
committerYigit Sever2022-04-23 20:29:36 +0300
commit21095d29f348d8c965df9871bbc0644de5000a53 (patch)
treec13444763ca514869192022fac8b861bd8663620 /src/routes.rs
parentd76de7951d995026feaeb92c278f45e810acd3de (diff)
downloadgradecoin-21095d29f348d8c965df9871bbc0644de5000a53.tar.gz
gradecoin-21095d29f348d8c965df9871bbc0644de5000a53.tar.bz2
gradecoin-21095d29f348d8c965df9871bbc0644de5000a53.zip
Format, refactor, succinct errors
Diffstat (limited to 'src/routes.rs')
-rw-r--r--src/routes.rs25
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 @@
3use crate::custom_filters; 3use crate::custom_filters;
4use crate::handlers; 4use crate::handlers;
5use crate::Db; 5use crate::Db;
6use warp::{Filter, filters::BoxedFilter, Rejection, Reply}; 6use log::info;
7use log::{info}; 7use warp::{filters::BoxedFilter, Filter, Rejection, Reply};
8 8
9/// Every route combined for a single network 9/// Every route combined for a single network
10pub fn network(db: Db) -> BoxedFilter<(impl Reply,)> { 10pub 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