26 lines
652 B
JavaScript
26 lines
652 B
JavaScript
const mysql = require("mysql2")
|
|
const mysqlProm = require("mysql2/promise")
|
|
|
|
const pool = mysql.createConnection({
|
|
host: process.env.DATABASE_HOST,
|
|
port: process.env.DATABASE_PORT,
|
|
database: process.env.DATABASE_NAME,
|
|
user: process.env.DATABASE_USERNAME,
|
|
password: process.env.DATABASE_PASSWORD,
|
|
})
|
|
|
|
const db = mysqlProm.createPool({
|
|
host: process.env.DATABASE_HOST,
|
|
port: process.env.DATABASE_PORT,
|
|
database: process.env.DATABASE_NAME,
|
|
user: process.env.DATABASE_USERNAME,
|
|
password: process.env.DATABASE_PASSWORD,
|
|
})
|
|
|
|
pool.connect(function (err) {
|
|
if (err) throw err
|
|
console.log("Connected!")
|
|
})
|
|
|
|
module.exports = { pool, db }
|