diff options
author | Yigit Sever | 2021-04-15 03:50:34 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-15 03:50:34 +0300 |
commit | dcc2d99140d25c5f163e425fb6ed7246fe88ea54 (patch) | |
tree | 9108ff3aa44622ff0bda4bb82d9b1fb38f168dfe /src | |
parent | be037a6b35056ec8aa8f75e56becd009bc7c01f2 (diff) | |
parent | 412276f8dac075836aaa8fdf636aa068718a2bbf (diff) | |
download | gradecoin-dcc2d99140d25c5f163e425fb6ed7246fe88ea54.tar.gz gradecoin-dcc2d99140d25c5f163e425fb6ed7246fe88ea54.tar.bz2 gradecoin-dcc2d99140d25c5f163e425fb6ed7246fe88ea54.zip |
Merge remote-tracking branch 'origin/template' into template
Diffstat (limited to 'src')
-rw-r--r-- | src/handlers.rs | 11 | ||||
-rw-r--r-- | src/routes.rs | 11 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index b3a6fa8..7135190 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
@@ -194,17 +194,6 @@ pub async fn authenticate_user( | |||
194 | Ok(warp::reply::with_status(res_json, StatusCode::CREATED)) | 194 | Ok(warp::reply::with_status(res_json, StatusCode::CREATED)) |
195 | } | 195 | } |
196 | 196 | ||
197 | // fn shed_pem_header_footer(maybe_key: String) -> Result<Vec<u8>, String> { | ||
198 | // let der_encoded = maybe_key | ||
199 | // .lines() | ||
200 | // .filter(|line| !line.starts_with("-")) | ||
201 | // .fold(String::new(), |mut data, line| { | ||
202 | // data.push_str(&line); | ||
203 | // data | ||
204 | // }); | ||
205 | // Ok(base64::decode(&der_encoded).expect("failed to decode base64 content")) | ||
206 | // } | ||
207 | |||
208 | /// GET /transaction | 197 | /// GET /transaction |
209 | /// Returns JSON array of transactions | 198 | /// Returns JSON array of transactions |
210 | /// Cannot fail | 199 | /// Cannot fail |
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 |