const mysql = require('mysql2') const logger = require('./logger')() require('dotenv').config() // Authenticates with SQL server and send query class Database { constructor(x) { this.host = x.host this.user = x.username this.password = x.password this.database = x.database } CreatePool() { return mysql.createPool({ host: this.host, user: this.user, password: this.password, database: this.database }).promise() } Query(x) {return this.pool.query(x)} } module.exports = (x) => { const database = new Database(x) const pools = [] const createPool = () => { pools.push(database.CreatePool()) } return { pools: pools, createPool: createPool } }