diff options
| author | Yigit Sever | 2021-04-07 01:08:31 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-04-07 01:08:31 +0300 |
| commit | c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc (patch) | |
| tree | 43345c12a7caf4c94532a7b54638e756af10b3af /src/main.rs | |
| download | gradecoin-c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc.tar.gz gradecoin-c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc.tar.bz2 gradecoin-c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc.zip | |
Initial commit
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..bcd4173 --- /dev/null +++ b/src/main.rs | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | use std::env; | ||
| 2 | use warp::Filter; | ||
| 3 | |||
| 4 | mod custom_filters; | ||
| 5 | mod handlers; | ||
| 6 | mod routes; | ||
| 7 | mod schema; | ||
| 8 | // mod validators; | ||
| 9 | |||
| 10 | #[tokio::main] | ||
| 11 | async fn main() { | ||
| 12 | // Show debug logs by default by setting `RUST_LOG=restful_rust=debug` | ||
| 13 | if env::var_os("RUST_LOG").is_none() { | ||
| 14 | env::set_var("RUST_LOG", "restful_rust=debug"); | ||
| 15 | } | ||
| 16 | pretty_env_logger::init(); | ||
| 17 | |||
| 18 | let db = schema::ledger(); // 1. we need this to return a _simple_ db | ||
| 19 | |||
| 20 | let api = routes::consensus_routes(db); | ||
| 21 | |||
| 22 | let routes = api.with(warp::log("restful_rust")); | ||
| 23 | |||
| 24 | // Start the server | ||
| 25 | warp::serve(routes).run(([127, 0, 0, 1], 8080)).await; | ||
| 26 | } | ||
