text: const mysql = require('mysql');
  
  class Database {
      constructor(host, user, password, database) {
          this.connection = mysql.createConnection({
              host: host,
              user: user,
              password: password,
              database: database
          });
      }
  
      query(sql, args) {
          return new Promise((resolve, reject) => {
              this.connection.query(sql, args, (err, rows) => {
                  if (err)
                      return reject(err);
                  resolve(rows);
              });
          });
      }
  
      close() {
          return new Promise((resolve, reject) => {
              this.connection.end(err => {
                  if (err)
                      return reject(err);
                  resolve();
              });
          });
      }
  }
  
  exports.database = Database;