Created
February 14, 2019 15:51
-
-
Save tkssharma/5e11319d98a76369fc7e9a87312aab9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mysql = require('mysql2/promise'); | |
const config = { | |
user: 'root', | |
password: 'root', | |
database: 'testdb', | |
host: 'mysql', | |
connectTimeout: 80000, | |
}; | |
mysql.createConnection(config) | |
.then((connection) => { | |
console.log(`connection established to local ${config.database} database`); | |
global.MYconnection = connection; | |
}) | |
.catch((e) => { | |
console.log(e); | |
eventEmitter.emit('connectionFailed', 'Destination'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment