diff options
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 | } | ||