mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-22 14:26:29 +01:00
Add db connector
This commit is contained in:
parent
fbe9fb39c5
commit
b98fdb5a6c
2 changed files with 11 additions and 16 deletions
16
db.js
16
db.js
|
@ -1,16 +0,0 @@
|
||||||
var mysql = require("mysql");
|
|
||||||
var db_connect = mysql.createConnection({
|
|
||||||
host: "ruka.moe.team",
|
|
||||||
user: "admin_nekoya",
|
|
||||||
password: "Nekoya123.",
|
|
||||||
database: "admin_nekoya",
|
|
||||||
});
|
|
||||||
db_connect.connect(function (err) {
|
|
||||||
if (!err) {
|
|
||||||
console.log("Database Connected !!!");
|
|
||||||
} else {
|
|
||||||
console.log("There was a problem connecting to the database ....");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = db_connect;
|
|
11
modules/db.js
Normal file
11
modules/db.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
var mysql = require('mysql2');
|
||||||
|
const config = require('../config');
|
||||||
|
|
||||||
|
function connect(sql, params) {
|
||||||
|
const connection = mysql.createConnection(config.db);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
connect
|
||||||
|
}
|
Loading…
Reference in a new issue