diff options
Diffstat (limited to 'src/routes.rs')
| -rw-r--r-- | src/routes.rs | 11 | 
1 files changed, 9 insertions, 2 deletions
| diff --git a/src/routes.rs b/src/routes.rs index 280de35..52d357a 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
| @@ -7,11 +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 | // 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 | ||
| 13 | |||
| 14 | // Fully fledged website support, phew! | ||
| 15 | let static_route = warp::any().and(warp::fs::dir("public")); | ||
| 16 | |||
| 10 | transaction_list(db.clone()) | 17 | transaction_list(db.clone()) | 
| 11 | .or(register_user(db.clone())) | 18 | .or(register_user(db.clone())) | 
| 12 | .or(auth_transaction_propose(db.clone())) | 19 | .or(auth_transaction_propose(db.clone())) | 
| 13 | .or(auth_block_propose(db.clone())) | 20 | .or(auth_block_propose(db.clone())) | 
| 14 | .or(block_list(db.clone())) | 21 | .or(block_list(db)) | 
| 22 | .or(static_route) | ||
| 15 | } | 23 | } | 
| 16 | 24 | ||
| 17 | /// POST /register warp route | 25 | /// POST /register warp route | 
| @@ -60,4 +68,3 @@ pub fn auth_block_propose(db: Db) -> impl Filter<Extract = impl Reply, Error = R | |||
| 60 | .and(custom_filters::with_db(db)) | 68 | .and(custom_filters::with_db(db)) | 
| 61 | .and_then(handlers::authorized_propose_block) | 69 | .and_then(handlers::authorized_propose_block) | 
| 62 | } | 70 | } | 
| 63 | |||
