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