foxtrot_mfa/src/main.rs
2023-03-08 14:57:27 +00:00

25 lines
612 B
Rust
Executable File

#[macro_use] extern crate rocket;
use rocket::fs::{FileServer, relative}; // for serving static dir
mod database;
mod api;
mod cert;
#[launch]
pub async fn rocket() -> _ {
let pool_result = database::connect().await;
let pool = match pool_result {
Ok(pool) => pool,
Err(e) => panic!("Error with database connection, {}", e)
};
rocket::build()
.manage(api::Pool(pool))
.mount("/", FileServer::from(relative!("static")))
.mount("/", routes![api::user_create])
.mount("/", routes![api::user_login])
.mount("/", routes![api::user_cert])
}