var mysql = require('mysql'); var settings = require('./settings.js'); module.exports = { /** * Variable de instancia del pool */ pool: null, /** * Iniciar pool de conexión con la base de datos */ init: function() { this.pool = mysql.createPool(settings.mysql()); this.pool.getConnection(function(error, connection) { if (error) { throw new Error('Can\'t connect to database: ' + error.code); } else if (settings.app().debug) { console.log('Database connection stablished'); } }); } };