// This client code really just serves as the url router for the main website where we describe what the project is about #![feature(proc_macro_hygiene, decl_macro, plugin)] #[macro_use] extern crate serde_derive; #[macro_use] extern crate rocket; #[macro_use] extern crate rocket_contrib; #[macro_use] extern crate diesel; extern crate chrono; extern crate dotenv; extern crate serde; extern crate serde_json; extern crate rand; extern crate getrandom; use rocket_contrib::serve::StaticFiles; use rocket_contrib::templates::Template; use dotenv::dotenv; use std::env::var; mod schema; mod models; mod invites; mod payload; mod rand_utils; mod users; mod channels; mod err; mod auth; use invites::*; use channels::*; use users::*; #[database("freechat")] pub struct DBConn(diesel::MysqlConnection); pub fn rocket() -> rocket::Rocket { rocket::ignite() .mount("/static", StaticFiles::from("/static")) .mount("/invite", routes![ generate_invite, use_invite ]) .mount("/channels", routes![ get_voice_channels, insert_new_channel, get_text_chanels ]) .mount("/users", routes![ remove_user, get_user_list ]) .attach(Template::fairing()) .attach(DBConn::fairing()) } fn main() -> Result<(), i32> { match dotenv() { Ok(_d) => { println!("Got .env: {:?}", var("DATABASE_URL").unwrap()); rocket().launch(); }, Err(e) => { panic!("`.env` Could not be loaded err: {:?}", e); } } Ok(()) }