blob: 4b8762d2b72a7040c32d6ddccf3d5c37a89aee3c (
plain)
use actix_web::{web::Data, App, HttpServer};
use exun::RawUnexpected;
mod api;
mod models;
mod services;
use services::*;
#[actix_web::main]
async fn main() -> Result<(), RawUnexpected> {
// initialize the database
let db_url = secrets::database_url()?;
let sql_pool = db::initialize(&db_url).await?;
// start the server
HttpServer::new(move || {
App::new()
.app_data(Data::new(sql_pool.clone()))
.service(api::liveops())
.service(api::users())
.service(api::ops())
})
.shutdown_timeout(1)
.bind(("127.0.0.1", 8080))?
.run()
.await?;
Ok(())
}
|