const mysql = require('mysql');
const pool = mysql.createPool({
port: 3306,
user: 'root',
password: 'root',
database: 'people'
})
const query = (sql, arr, cb) => {
pool.getConnection((err, con) => {
if (err) {
return cb && cb(err);
}
con.query(sql, arr, (err, result) => {
if (err) {
return cb && cb(err);
}
cb && cb(null, result);
con.release();
})
})
}
module.exports = query;