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