diff options
| author | Yigit Sever | 2021-04-13 20:37:54 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-04-13 20:37:54 +0300 |
| commit | 4de129bbae1a26b8ee62d7ec1f73d60e6cbcc530 (patch) | |
| tree | 9c673b1f0f7e1c53ab853cbbda93d74705a5a6ad /src/bin | |
| parent | ed9ffcef84e65308e4e6aff018d901fe36b17b7f (diff) | |
| download | gradecoin-4de129bbae1a26b8ee62d7ec1f73d60e6cbcc530.tar.gz gradecoin-4de129bbae1a26b8ee62d7ec1f73d60e6cbcc530.tar.bz2 gradecoin-4de129bbae1a26b8ee62d7ec1f73d60e6cbcc530.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 | } |
