23 lines
503 B
JavaScript
23 lines
503 B
JavaScript
|
|
const mysql = require('mysql2');
|
|
|
|
// Create a connection pool
|
|
const database = mysql.createPool({
|
|
host: '192.168.0.236',
|
|
user: 'cudnodejs',
|
|
password: 'iDvuHQsPXF5AasESydypgu',
|
|
database: 'cudnodejs',
|
|
connectionLimit: 10
|
|
});
|
|
|
|
database.getConnection((err, connection) => {
|
|
if(err) {
|
|
console.error('Error connecting to the database:', err);
|
|
} else {
|
|
console.log('Connected to the database');
|
|
connection.release();
|
|
}
|
|
});
|
|
|
|
// Export the connection pool
|
|
module.exports = database;
|