2019-12-16 23:02:28 +00:00
|
|
|
var fs = require("fs")
|
|
|
|
var mariadb = require('mariadb');
|
|
|
|
|
|
|
|
const pool = mariadb.createPool({
|
2019-12-16 23:14:44 +00:00
|
|
|
host: 'Host_Here',
|
|
|
|
user:'Username_Here',
|
2019-12-16 23:02:28 +00:00
|
|
|
port: 5002,
|
2019-12-16 23:14:44 +00:00
|
|
|
password: "Password_Here",
|
2019-12-16 23:02:28 +00:00
|
|
|
database: 'flights',
|
|
|
|
connectionLimit: 5
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports={
|
|
|
|
getConnection: function(){
|
|
|
|
return new Promise(function(resolve,reject){
|
|
|
|
pool.getConnection().then(function(connection){
|
|
|
|
resolve(connection);
|
|
|
|
}).catch(function(error){
|
|
|
|
reject(error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|