diff options
author | Yigit Sever | 2021-04-13 04:05:44 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-13 04:05:49 +0300 |
commit | b06cbd69fc2a7544f6f62c20cbdfb30bda194101 (patch) | |
tree | e639c13328c3c0083f3f343fb5633290ec2bf29c /src/bin | |
parent | 42cad1e409727ae8e1fd9f9d1c0b520e9c0565f8 (diff) | |
download | gradecoin-b06cbd69fc2a7544f6f62c20cbdfb30bda194101.tar.gz gradecoin-b06cbd69fc2a7544f6f62c20cbdfb30bda194101.tar.bz2 gradecoin-b06cbd69fc2a7544f6f62c20cbdfb30bda194101.zip |
Housekeeping
Moved tests out of routes.rs into their own file
Learned how to use lib.rs, now we have cargo doc support as well
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/main.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs new file mode 100644 index 0000000..8d88286 --- /dev/null +++ b/src/bin/main.rs | |||
@@ -0,0 +1,25 @@ | |||
1 | use std::env; | ||
2 | use warp::Filter; | ||
3 | |||
4 | use gradecoin::routes::consensus_routes; | ||
5 | use gradecoin::schema::create_database; | ||
6 | |||
7 | // mod validators; | ||
8 | |||
9 | #[tokio::main] | ||
10 | async fn main() { | ||
11 | // Show debug logs by default by setting `RUST_LOG=restful_rust=debug` | ||
12 | if env::var_os("RUST_LOG").is_none() { | ||
13 | env::set_var("RUST_LOG", "gradecoin=debug"); | ||
14 | } | ||
15 | pretty_env_logger::init(); | ||
16 | |||
17 | let db = create_database(); | ||
18 | |||
19 | let api = consensus_routes(db); | ||
20 | |||
21 | let routes = api.with(warp::log("gradecoin")); | ||
22 | |||
23 | // Start the server | ||
24 | warp::serve(routes).run(([127, 0, 0, 1], 8080)).await; | ||
25 | } | ||