feat: switch Dioxus to fullstack, add a form for creating a project
This commit is contained in:
12
src/server/database_connection.rs
Normal file
12
src/server/database_connection.rs
Normal file
@ -0,0 +1,12 @@
|
||||
use diesel::pg::PgConnection;
|
||||
use diesel::prelude::*;
|
||||
use dotenvy::dotenv;
|
||||
use std::env;
|
||||
|
||||
pub(crate) fn establish_database_connection() -> PgConnection {
|
||||
dotenv().ok();
|
||||
|
||||
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||
PgConnection::establish(&database_url)
|
||||
.unwrap_or_else(|_| panic!("error connecting to {}", database_url))
|
||||
}
|
Reference in New Issue
Block a user