-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathindex.js
35 lines (26 loc) · 938 Bytes
/
index.js
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
const dbConfig = require("../config/db.config.js");
const Sequelize = require("sequelize");
// const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, {
// host: dbConfig.HOST,
// dialect: dbConfig.dialect,
// pool: {
// max: dbConfig.pool.max,
// min: dbConfig.pool.min,
// acquire: dbConfig.pool.acquire,
// idle: dbConfig.pool.idle
// }
// });
// Connection string
const connectionString = 'postgres://postgres_user:J4lg1IhAM7viuX8EH6PnUKx8Q9U8xECm@dpg-co7bp0n109ks73860js0-a.oregon-postgres.render.com/testdb_vnej';
// Initialize Sequelize with the connection string
const sequelize = new Sequelize(connectionString, {
dialect: 'postgres', // Specify the dialect
dialectOptions: {
ssl: true // Enable SSL
}
});
const db = {};
db.Sequelize = Sequelize;
db.sequelize = sequelize;
db.tutorials = require("./tutorial.model.js")(sequelize, Sequelize);
module.exports = db;