Files

28 lines
691 B
JavaScript
Raw Permalink Normal View History

2025-05-22 18:33:00 -04:00
const mysql = require('mysql2/promise');
2025-05-19 21:27:10 -04:00
const envConfig = require('./envConfigurations/EnvConfigurations');
2025-05-22 18:33:00 -04:00
const pool = mysql.createPool({
2025-05-19 21:27:10 -04:00
host: envConfig.db.host,
port: envConfig.db.port,
user: envConfig.db.user,
password: envConfig.db.password,
2025-05-22 18:33:00 -04:00
database: envConfig.db.name,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 40,
connectTimeout: 5000
2025-05-19 21:27:10 -04:00
});
2025-05-22 18:33:00 -04:00
(async () => {
try {
const connection = await pool.getConnection();
console.log('Conectado con la base de datos');
connection.release();
} catch (err) {
console.error('Error al conectarse con la base de datos:', err.message);
process.exit(1);
2025-05-19 21:27:10 -04:00
}
2025-05-22 18:33:00 -04:00
})();
2025-05-19 21:27:10 -04:00
2025-05-22 18:33:00 -04:00
module.exports = pool;
//IO