2020-10-14 20:36:24 +00:00
|
|
|
#![feature(decl_macro, proc_macro_hygiene)]
|
2020-10-13 23:40:03 +00:00
|
|
|
|
2020-10-14 22:42:08 +00:00
|
|
|
pub mod config;
|
2020-10-14 21:47:16 +00:00
|
|
|
mod database;
|
2020-10-14 21:54:19 +00:00
|
|
|
mod routes;
|
2020-10-14 21:28:09 +00:00
|
|
|
mod schema;
|
2020-10-14 21:48:53 +00:00
|
|
|
mod models;
|
2020-10-14 23:53:24 +00:00
|
|
|
mod forms;
|
2020-10-14 21:28:09 +00:00
|
|
|
|
|
|
|
#[macro_use] extern crate diesel;
|
2020-10-13 23:40:03 +00:00
|
|
|
#[macro_use] extern crate rocket;
|
2020-10-14 00:13:00 +00:00
|
|
|
#[macro_use] extern crate serde_derive;
|
2020-10-14 20:27:21 +00:00
|
|
|
|
2020-10-14 00:13:00 +00:00
|
|
|
extern crate rocket_contrib;
|
2020-10-13 23:40:03 +00:00
|
|
|
|
2020-10-14 00:01:25 +00:00
|
|
|
use rocket_contrib::templates::Template;
|
|
|
|
|
2020-10-14 00:26:03 +00:00
|
|
|
fn main() {
|
2020-10-14 22:42:08 +00:00
|
|
|
let config = config::Config::default().unwrap();
|
|
|
|
|
|
|
|
rocket(config).launch();
|
2020-10-14 00:27:00 +00:00
|
|
|
}
|
|
|
|
|
2020-10-14 22:42:08 +00:00
|
|
|
fn rocket(config: config::Config) -> rocket::Rocket {
|
2020-10-14 22:56:01 +00:00
|
|
|
rocket::custom(config.to_rocket_config().unwrap())
|
2020-10-14 22:51:17 +00:00
|
|
|
.manage(database::create_db_pool(config))
|
2020-10-14 00:26:03 +00:00
|
|
|
.attach(Template::fairing())
|
2020-10-14 21:54:19 +00:00
|
|
|
.mount("/", routes::routes())
|
2020-10-13 23:40:03 +00:00
|
|
|
}
|