diff options
author | Yigit Sever | 2021-04-13 20:37:54 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-13 20:37:54 +0300 |
commit | 23e4f52284ad5fa0b068220c54a255ff9fa7b18f (patch) | |
tree | 627671c12ea45f8a516601141e52005803384d47 /src/bin | |
parent | b16da2c2b64f753129bb33b734a7982e2622ddd3 (diff) | |
download | gradecoin-23e4f52284ad5fa0b068220c54a255ff9fa7b18f.tar.gz gradecoin-23e4f52284ad5fa0b068220c54a255ff9fa7b18f.tar.bz2 gradecoin-23e4f52284ad5fa0b068220c54a255ff9fa7b18f.zip |
Add verbose error messages
Not happy with the solution one bit but using error.rs at
https://blog.logrocket.com/create-an-async-crud-web-service-in-rust-with-warp/
was not working
Basically we just handcraft every single response on the spot, there is
some repetition and it's ugly but need to move on
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/main.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index 598a2e1..8b61e5c 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs | |||
@@ -1,6 +1,7 @@ | |||
1 | use std::env; | 1 | use std::env; |
2 | use warp::Filter; | 2 | use warp::Filter; |
3 | 3 | ||
4 | // use gradecoin::error; | ||
4 | use gradecoin::routes::consensus_routes; | 5 | use gradecoin::routes::consensus_routes; |
5 | use gradecoin::schema::create_database; | 6 | use gradecoin::schema::create_database; |
6 | 7 | ||
@@ -9,6 +10,7 @@ use gradecoin::schema::create_database; | |||
9 | #[tokio::main] | 10 | #[tokio::main] |
10 | async fn main() { | 11 | async fn main() { |
11 | // Show debug logs by default by setting `RUST_LOG=gradecoin=debug` | 12 | // Show debug logs by default by setting `RUST_LOG=gradecoin=debug` |
13 | // TODO: write logs to file? <13-04-21, yigit> // | ||
12 | if env::var_os("RUST_LOG").is_none() { | 14 | if env::var_os("RUST_LOG").is_none() { |
13 | env::set_var("RUST_LOG", "gradecoin=debug"); | 15 | env::set_var("RUST_LOG", "gradecoin=debug"); |
14 | } | 16 | } |
@@ -21,5 +23,6 @@ async fn main() { | |||
21 | let routes = api.with(warp::log("gradecoin")); | 23 | let routes = api.with(warp::log("gradecoin")); |
22 | 24 | ||
23 | // Start the server | 25 | // Start the server |
24 | warp::serve(routes).run(([127, 0, 0, 1], 8080)).await; | 26 | let point = ([127, 0, 0, 1], 8080); |
27 | warp::serve(routes).run(point).await; | ||
25 | } | 28 | } |