tenebrous-sheets/src/main.rs

50 lines
1.1 KiB
Rust

#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
#[macro_use]
extern crate diesel;
// Seemingly necessary to get serde::Serialize into scope for Prost
// code generation.
#[macro_use]
extern crate serde_derive;
use rocket_contrib::serve::StaticFiles;
use rocket_contrib::templates::Template;
pub mod catchers;
pub mod db;
pub mod errors;
pub mod models;
pub mod routes;
pub mod schema;
#[rocket::main]
async fn main() -> Result<(), rocket::error::Error> {
let root_routes: Vec<rocket::Route> = {
routes::root::routes()
.into_iter()
.chain(routes::auth::routes().into_iter())
.collect()
};
let character_routes = routes::characters::routes();
let catchers = catchers::catchers();
rocket::ignite()
.attach(Template::fairing())
.attach(db::TenebrousDbConn::fairing())
.mount("/", root_routes)
.mount("/characters", character_routes)
.mount(
"/protos",
StaticFiles::from(concat!(env!("CARGO_MANIFEST_DIR"), "/proto")),
)
.register(catchers)
.launch()
.await
}