I was using the standard node mysql package and abstracted away my db connections as such.
const mysql = require('mysql');
const connection = mysql.createConnection({
host: host,
user: user,
password: password,
database: database
});
module.exports = connection;
I want to use promises and am trying to use the wrappered promise-mysql package.
However, I'm unclear as to if I can still export my connection object.
const mysql = require('promise-mysql');
const connection = await mysql.createConnection({
host: host,
user: user,
password: password,
database: database
});
module.exports = connection;
Do I have to wrap the module.exports in an IIFE or something?