Tchat/bdd.js

18 lines
432 B
JavaScript
Raw Normal View History

2018-12-26 13:14:06 +01:00
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;