-
Notifications
You must be signed in to change notification settings - Fork 3
/
connectivity.js
54 lines (41 loc) · 1.05 KB
/
connectivity.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const { Sequelize } = require('sequelize');
require("dotenv").config()
// console.log(process.env.DB_URL)
const sequelize = new Sequelize(
// 'postgres://admin:lkke9PVa4A7odq3nxEMY2wOEIm22l9EP@dpg-cmruecta73kc739h2ssg-a.oregon-postgres.render.com/customerdb_t80t'
process.env.DB_URL,{
dialect: "postgres",
logging: false,
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false,
},
},
})
sequelize
.sync()
.then(() => {
console.log('DB Connected')
})
.catch((err) => {
console.log(err)
})
// console.log(sequelize.config.password)
// const { Client } = require('pg')
// const client = new Client ({
// user: 'admin',
// host: 'dpg-cmruecta73kc739h2ssg-a',
// database:'customerdb_t80t',
// password:'lkke9PVa4A7odq3nxEMY2wOEIm22l9EP',
// port:'5432',
// })
// client.connect((err) => {
// if(err) {
// console.error('Connection error - ', err.stack)
// }
// else {
// console.log('DB Connected')
// }
// })
// module.exports = client;