Basic Database
This commit is contained in:
1 parent
c29ab25dd2
commit
fee34ba257
23 files changed
+459
-155
No files matched your search
@@ -0,0 +1,11 @@
|
||||
use diesel::prelude::*;
|
||||
use diesel::pg::PgConnection;
|
||||
use dotenv::dotenv;
|
||||
use std::env;
|
||||
|
||||
pub fn connect() -> PgConnection{
|
||||
dotenv.ok();
|
||||
|
||||
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set!");
|
||||
PgConnection::establish(&database_url).expect(&format!("Error connecting to {}", database_url))
|
||||
}
|
||||
Reference in new issue
Block a user