diff options
| author | mrw1593 <botahamec@outlook.com> | 2023-03-19 11:19:40 -0400 |
|---|---|---|
| committer | mrw1593 <botahamec@outlook.com> | 2023-03-19 11:19:40 -0400 |
| commit | c00129570baaabe71a3778bc35820e441f51174b (patch) | |
| tree | a813caca5c22a9ae0a33d861ce6d87b248ea9831 /src/main.rs | |
| parent | e1793b571eadb06c3da09697d379eccd72b12b73 (diff) | |
Setup sqlx
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs index ec04d93..5104428 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,21 @@ -use std::time::Duration; - -use actix_web::{App, HttpServer}; +use actix_web::{web::Data, App, HttpServer}; +use exun::RawUnexpected; mod api; +mod services; #[actix_web::main] -async fn main() -> std::io::Result<()> { - HttpServer::new(|| App::new().service(api::liveops())) - .shutdown_timeout(1) - .bind(("127.0.0.1", 8080))? - .run() - .await +async fn main() -> Result<(), RawUnexpected> { + let sql_pool = services::db::initialize("password_database", "dbuser", "Demo1234").await?; + HttpServer::new(move || { + App::new() + .app_data(Data::new(sql_pool.clone())) + .service(api::liveops()) + }) + .shutdown_timeout(1) + .bind(("127.0.0.1", 8080))? + .run() + .await?; + + Ok(()) } |
