diff options
author | Yigit Sever | 2021-04-15 02:35:45 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-15 02:35:45 +0300 |
commit | 5daa99b07e32c2436726a155ead25c7e61532916 (patch) | |
tree | 37788c4cf05a826ae21be3466ecbe2bde39e95f9 /src | |
parent | 7f91412ddf3895214a8b56ac520ea7a60c0d24a1 (diff) | |
download | gradecoin-5daa99b07e32c2436726a155ead25c7e61532916.tar.gz gradecoin-5daa99b07e32c2436726a155ead25c7e61532916.tar.bz2 gradecoin-5daa99b07e32c2436726a155ead25c7e61532916.zip |
Add static serving support
Diffstat (limited to 'src')
-rw-r--r-- | src/routes.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/routes.rs b/src/routes.rs index f8d9605..59342bb 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -7,14 +7,19 @@ use crate::schema::Db; | |||
7 | 7 | ||
8 | /// Every route combined | 8 | /// Every route combined |
9 | pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { | 9 | pub fn consensus_routes(db: Db) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { |
10 | let welcome_route = warp::path::end().and_then(handlers::welcome_handler); | 10 | // Remember when we wanted to implement templating |
11 | // Why would we? Just put a staic webpage under /public (next to Cargo.toml) and place it and | ||
12 | // the end of the filter chain | ||
11 | 13 | ||
12 | welcome_route | 14 | // Fully fledged website support, phew! |
13 | .or(transaction_list(db.clone())) | 15 | let static_route = warp::any().and(warp::fs::dir("public")); |
16 | |||
17 | transaction_list(db.clone()) | ||
14 | .or(register_user(db.clone())) | 18 | .or(register_user(db.clone())) |
15 | .or(auth_transaction_propose(db.clone())) | 19 | .or(auth_transaction_propose(db.clone())) |
16 | .or(auth_block_propose(db.clone())) | 20 | .or(auth_block_propose(db.clone())) |
17 | .or(block_list(db.clone())) | 21 | .or(block_list(db.clone())) |
22 | .or(static_route) | ||
18 | } | 23 | } |
19 | 24 | ||
20 | /// POST /register warp route | 25 | /// POST /register warp route |