18 lines
432 B
JavaScript
18 lines
432 B
JavaScript
|
const config = require('./config.json');
|
||
|
var mysql = require('mysql');
|
||
|
|
||
|
var connection = mysql.createConnection({
|
||
|
host: "localhost",
|
||
|
user: config.bdd.user,
|
||
|
password: config.bdd.pw,
|
||
|
database : config.bdd.dbname
|
||
|
});
|
||
|
connection.connect(function(err){
|
||
|
if(!err) {
|
||
|
console.log("Database is connected");
|
||
|
} else {
|
||
|
console.log("Error while connecting with database");
|
||
|
}
|
||
|
});
|
||
|
module.exports = connection;
|