summaryrefslogtreecommitdiff
path: root/server/src/main.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-08-22 16:06:28 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-08-22 16:06:28 +0200
commit14968097b28919f7e1f71ec5e49b30191826fa33 (patch)
tree1eda1c77577618491a7330ab2c67bca6f6c5139e /server/src/main.rs
parent7c40a2f9ead877620ab74b5a5c35a70db1c94362 (diff)
Sqlx connection
Diffstat (limited to 'server/src/main.rs')
-rw-r--r--server/src/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 2f4a727..e061b83 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -1,6 +1,7 @@
mod db;
mod errors;
mod logger;
+use sqlx::postgres::PgPool;
use axum::{
http::{header, Request},
@@ -29,6 +30,13 @@ async fn main() {
async fn create_app() -> Router {
logger::setup();
+ let _ = db::setup().await;
+ let pool = unsafe {
+ match db::get_client() {
+ Some(client) => client,
+ None => panic!("Connection not established!"),
+ }
+ };
Router::new()
.route("/", get(hej))