aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: 91f67573fd396c39e00f1090d0030d86c352f925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::env;
use warp::Filter;

mod custom_filters;
mod handlers;
mod routes;
mod schema;
mod auth;
mod error;
// 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", "gradecoin=debug");
    }
    pretty_env_logger::init();

    let db = schema::create_database();

    let api = routes::consensus_routes(db);

    let routes = api.with(warp::log("gradecoin"));

    // Start the server
    warp::serve(routes).run(([127, 0, 0, 1], 8080)).await;
}