-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmysql.js
More file actions
32 lines (28 loc) · 754 Bytes
/
mysql.js
File metadata and controls
32 lines (28 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var mysql = require("mysql");
MYSQL_HOST = "findtroll.ci8vlkmfvuq6.ap-northeast-2.rds.amazonaws.com";
MYSQL_USER = "admin";
MYSQL_PASSWORD = "9UdLF5Kg";
RIOT_API_KEY = "RGAPI-c5c7eaa5-0cd3-401d-a9e0-8f3b564d4a9a";
var connection = mysql.createConnection({
host: MYSQL_HOST,
user: MYSQL_USER,
password: MYSQL_PASSWORD,
database: "FindTroll",
dateStrings: "true",
port: 3306,
acquireTimeout: 30000, //30 secs
});
connection.connect();
module.exports = {
async do(query, value) {
return new Promise((resolve, reject) => {
connection.query(query, value, function (err, rows, fields) {
if (err) {
console.log(err);
return reject(err);
}
return resolve(rows);
});
});
},
};