aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 8a1548a80737b4cc5e3b33859a3d9c4a7ba9614e (plain) (blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#![feature(proc_macro_hygiene, decl_macro, option_result_contains)]

#[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;
extern crate rocket_contrib;
extern crate serde_json;

mod api;
mod ui;
mod db;
mod structures;

use rocket_contrib::templates::Template;
use actix_web::{
    error::ErrorInternalServerError, get, middleware::Logger, web,
    App, Error, HttpResponse, HttpServer
};

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    // rocket::ignite()
    //     .attach(Template::fairing())
    //     .register(catchers![
    //         ui::not_found
    //     ])
    //     .mount("/", routes![
    //         ui::index,
    //         ui::boards,
    //         ui::board
    //     ])
    //     .mount("/api/v1/", routes![
    //         api::post
    //     ])
    //     .launch();

    HttpServer::new(move || App::new().wrap(Logger::default())
        .service(ui::index)
        .service(ui::boards)
    )
    .bind("127.0.0.1:8000")?
    .run()
    .await
}