pre async
This commit is contained in:
parent
f7824d67e5
commit
512a69319c
13 changed files with 633 additions and 362 deletions
23
config/database.js
Normal file
23
config/database.js
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue