aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes.rs
diff options
context:
space:
mode:
authornecrashter2022-04-23 15:09:43 +0300
committerYigit Sever2022-04-23 18:10:12 +0300
commitf14c4bc7fc74d39b31b049c10421609e6e048a69 (patch)
tree89e69fd693042701c732e812ec7a688f8ff779f3 /src/routes.rs
parente21f7b96747d851d3e28282d18f316a48a6be51d (diff)
downloadgradecoin-f14c4bc7fc74d39b31b049c10421609e6e048a69.tar.gz
gradecoin-f14c4bc7fc74d39b31b049c10421609e6e048a69.tar.bz2
gradecoin-f14c4bc7fc74d39b31b049c10421609e6e048a69.zip
Support for multiple configs/routes
Diffstat (limited to 'src/routes.rs')
-rw-r--r--src/routes.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/routes.rs b/src/routes.rs
index cdbfc08..f53a20c 100644
--- a/src/routes.rs
+++ b/src/routes.rs
@@ -3,20 +3,17 @@
3use crate::custom_filters; 3use crate::custom_filters;
4use crate::handlers; 4use crate::handlers;
5use crate::Db; 5use crate::Db;
6use warp::{Filter, Rejection, Reply}; 6use warp::{Filter, filters::BoxedFilter, Rejection, Reply};
7
8/// Every route combined
9pub fn application(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
10 // gradecoin-site (zola) outputs a public/, we serve it here
11 let static_route = warp::any().and(warp::fs::dir("public"));
12 7
8/// Every route combined for a single network
9pub fn network(db: Db) -> BoxedFilter<(impl Reply,)> {
13 transaction_list(db.clone()) 10 transaction_list(db.clone())
14 .or(register_user(db.clone())) 11 .or(register_user(db.clone()))
15 .or(auth_transaction_propose(db.clone())) 12 .or(auth_transaction_propose(db.clone()))
16 .or(auth_block_propose(db.clone())) 13 .or(auth_block_propose(db.clone()))
17 .or(list_users(db.clone())) 14 .or(list_users(db.clone()))
18 .or(block_list(db)) 15 .or(block_list(db))
19 .or(static_route) 16 .boxed()
20} 17}
21 18
22/// GET /user warp route 19/// GET /user warp route