summaryrefslogtreecommitdiffstats
path: root/src/bin/main.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-13 20:37:54 +0300
committerYigit Sever2021-04-13 20:37:54 +0300
commit23e4f52284ad5fa0b068220c54a255ff9fa7b18f (patch)
tree627671c12ea45f8a516601141e52005803384d47 /src/bin/main.rs
parentb16da2c2b64f753129bb33b734a7982e2622ddd3 (diff)
downloadgradecoin-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/main.rs')
-rw-r--r--src/bin/main.rs5
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 @@
1use std::env; 1use std::env;
2use warp::Filter; 2use warp::Filter;
3 3
4// use gradecoin::error;
4use gradecoin::routes::consensus_routes; 5use gradecoin::routes::consensus_routes;
5use gradecoin::schema::create_database; 6use gradecoin::schema::create_database;
6 7
@@ -9,6 +10,7 @@ use gradecoin::schema::create_database;
9#[tokio::main] 10#[tokio::main]
10async fn main() { 11async 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}