aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorYigit Sever2021-04-13 04:05:44 +0300
committerYigit Sever2021-04-13 04:05:49 +0300
commit17d73bb73f4396c22ca24c3839a5449f5e28b4e5 (patch)
tree06b90d76e40101b462f2ddcfa89c768d78279ed6 /src/bin
parent0cc703bc74539f123d57d2d392eaf6b99eca26e7 (diff)
downloadgradecoin-17d73bb73f4396c22ca24c3839a5449f5e28b4e5.tar.gz
gradecoin-17d73bb73f4396c22ca24c3839a5449f5e28b4e5.tar.bz2
gradecoin-17d73bb73f4396c22ca24c3839a5449f5e28b4e5.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.rs25
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 @@
1use std::env;
2use warp::Filter;
3
4use gradecoin::routes::consensus_routes;
5use gradecoin::schema::create_database;
6
7// mod validators;
8
9#[tokio::main]
10async 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}