const mysql = require('mysql2/promise'); const credentials = require('./creds.json'); let connection = null; async function query(sql, params) { //console.log(sql); //console.log(params); if (null === connection) { console.log("Establishing connection to database!"); connection = await mysql.createConnection(credentials); } const [results, ] = await connection.execute(sql, params); return results; } module.exports = { query }