dbConfig.js 451 B

1234567891011121314151617
  1. // dbConfig.js
  2. const mysql = require('mysql');
  3. const connection = mysql.createConnection({
  4. host: process.env.CLOUDRON_MYSQL_HOST,
  5. user: process.env.CLOUDRON_MYSQL_USERNAME,
  6. port: process.env.CLOUDRON_MYSQL_PORT,
  7. password: process.env.CLOUDRON_MYSQL_PASSWORD,
  8. database: process.env.CLOUDRON_MYSQL_DATABASE,
  9. });
  10. connection.connect((err) => {
  11. if (err) throw err;
  12. console.log('Connected to the database');
  13. });
  14. module.exports = connection;