-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnection.js
More file actions
39 lines (33 loc) · 919 Bytes
/
connection.js
File metadata and controls
39 lines (33 loc) · 919 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
33
34
35
36
37
38
39
var mysql = require('mysql');
var Sequelize = require('sequelize');
// function Connection() {
// this.pool = null;
// this.init = function() {
// this.pool = mysql.createPool({
// host: 'http://agrihack.party:32769/',
// user: 'root',
// password: 'sakura#2017',
// database: 'sakura2017'
// });
// };
// this.acquire = function(callback) {
// this.pool.getConnection(function(err, connection) {
// callback(err, connection);
// });
// };
// }
var sequelize = new Sequelize('sakuratest','root','sakura#2017', {
host: 'agrihack.party',
port: '32769',
dialect: 'mysql',
pool : {
max: 5,
min: 0,
idle: 10000
}
});
sequelize.authenticate().then(() => {console.log('Connection has been established successfully.');})
.catch(err => {
console.error('Unable to connect to the database:', err);
});
module.exports.sequelize = sequelize;