28 lines
604 B
JavaScript
28 lines
604 B
JavaScript
const mysql = require("mysql2");
|
|
|
|
function createPool() {
|
|
// const pool = mysql.createPool({
|
|
// host: process.env.db_host,
|
|
// user: process.env.db_user,
|
|
// password: process.env.db_password,
|
|
// database: process.env.db_database,
|
|
// port: process.env.db_port,
|
|
// timezone: '+00:00'
|
|
// });
|
|
const pool = mysql.createPool({
|
|
});
|
|
return pool
|
|
}
|
|
|
|
const pool = createPool()
|
|
|
|
pool.getConnection(function(err, connection) {
|
|
if(err) {
|
|
console.log(err)
|
|
} else {
|
|
pool.getConnection(function(err, connection) {
|
|
connection.execute("USE Chickens;",[],console.log)
|
|
})
|
|
}
|
|
})
|