pre async

This commit is contained in:
Siwat Sirichai 2024-05-05 16:59:26 +07:00
parent f7824d67e5
commit 512a69319c
13 changed files with 633 additions and 362 deletions

23
config/database.js Normal file
View file

@ -0,0 +1,23 @@
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;