From c3ba5ad5ebe1d5bb28ed0a340af93e8547b1c5bc Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 7 Apr 2021 01:08:31 +0300 Subject: Initial commit --- src/main.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') 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 @@ +use std::env; +use warp::Filter; + +mod custom_filters; +mod handlers; +mod routes; +mod schema; +// mod validators; + +#[tokio::main] +async fn main() { + // Show debug logs by default by setting `RUST_LOG=restful_rust=debug` + if env::var_os("RUST_LOG").is_none() { + env::set_var("RUST_LOG", "restful_rust=debug"); + } + pretty_env_logger::init(); + + let db = schema::ledger(); // 1. we need this to return a _simple_ db + + let api = routes::consensus_routes(db); + + let routes = api.with(warp::log("restful_rust")); + + // Start the server + warp::serve(routes).run(([127, 0, 0, 1], 8080)).await; +} -- cgit v1.2.3-70-g09d2