-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Hi,
How could I close connection if i want to use some kind of db wrapper
const mysqlssh = require('mysql-ssh');
//const fs = require('fs');
var sqlConnect = mysqlssh.connect(
{
host: '192.168.33.10',
user: 'vagrant',
password: 'vagrant',
},
{
host: '127.0.0.1',
user: 'root',
password: 'root',
database: 'testing'
}
)
.catch(err => {
console.log(err)
})
module.exports = sqlConnect;
I tried to import on the other file... and tried to close connection but did not work
var sqlConnect = require('./db.js');
var mysqlssh = require('mysql-ssh');
sql.then( client => {
client.query("INSERT INTO tasks set ?", newTask, function (err, res) {
if(err) {
console.log("error: ", err);
result(err, null);
}
else{
console.log(res.insertId);
result(null, res.insertId);
}
});
}
)
.catch(err => {
console.log(err)
})
Metadata
Metadata
Assignees
Labels
No labels