genesis
This commit is contained in:
20
database.js
Normal file
20
database.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import sql from 'mssql';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config({ quiet: true });
|
||||
|
||||
const config = {
|
||||
user: process.env.DB_USER,
|
||||
password: process.env.DB_PASSWORD,
|
||||
server: process.env.DB_HOST,
|
||||
database: process.env.DB_DATABASE,
|
||||
options: {
|
||||
encrypt: false, // Adjust based on server config
|
||||
trustServerCertificate: true
|
||||
}
|
||||
};
|
||||
|
||||
export async function createConnection() {
|
||||
const pool = new sql.ConnectionPool(config);
|
||||
return await pool.connect();
|
||||
}
|
||||
Reference in New Issue
Block a user