mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-22 06:20:19 +01:00
23 lines
No EOL
376 B
JavaScript
23 lines
No EOL
376 B
JavaScript
var mysql = require('mysql2');
|
|
|
|
let config;
|
|
try {
|
|
config = require('../config');
|
|
} catch (e) {
|
|
console.log('No config file found');
|
|
process.exit(0);
|
|
}
|
|
|
|
function connect() {
|
|
const connection = mysql.createConnection(config.db);
|
|
return connection;
|
|
}
|
|
|
|
function disconnect(connection) {
|
|
connection.end();
|
|
}
|
|
|
|
module.exports = {
|
|
connect,
|
|
disconnect
|
|
} |