bugfix
This commit is contained in:
2
index.js
2
index.js
@@ -0,0 +1,2 @@
|
|||||||
|
const dbUtils = require('./utils/dbUtils');
|
||||||
|
const dbPoolUtils = require('./utils/dbPoolUtils');
|
@@ -80,6 +80,7 @@ function close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
createPool: createPool,
|
||||||
query: query,
|
query: query,
|
||||||
close: close,
|
close: close,
|
||||||
}
|
}
|
@@ -4,13 +4,14 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
let globalConfig = JSON.parse(fs.readFileSync(path.join(__dirname, '../config.json'), 'utf8'));
|
let globalConfig = JSON.parse(fs.readFileSync(path.join(__dirname, '../config.json'), 'utf8'));
|
||||||
let config = {
|
|
||||||
...globalConfig.mysql,
|
|
||||||
};
|
|
||||||
console.log(config);
|
|
||||||
|
|
||||||
async function query(sql) {
|
async function query(sql) {
|
||||||
//通过MySQL中方法创建链接对象
|
let config = {
|
||||||
|
...globalConfig.mysql,
|
||||||
|
};
|
||||||
|
console.log(config);
|
||||||
|
|
||||||
|
//通过MySQL中方法创建连接对象
|
||||||
var connection = mysql.createConnection(config);
|
var connection = mysql.createConnection(config);
|
||||||
//开始连接
|
//开始连接
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
Reference in New Issue
Block a user