25 lines
612 B
Rust
Executable File
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])
|
|
}
|
|
|