aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-07 01:08:31 +0300
committerYigit Sever2021-04-07 01:08:31 +0300
commitc3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc (patch)
tree43345c12a7caf4c94532a7b54638e756af10b3af /src/main.rs
downloadgradecoin-c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc.tar.gz
gradecoin-c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc.tar.bz2
gradecoin-c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc.zip
Initial commit
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
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 @@
1use std::env;
2use warp::Filter;
3
4mod custom_filters;
5mod handlers;
6mod routes;
7mod schema;
8// mod validators;
9
10#[tokio::main]
11async 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}