C.Evulukwu Anaba
C.Evulukwu Anaba

Reputation: 69

How do connect my Node.js backend server to pgAdmin4 using massive?

I'm trying to connect my server to my pgadmin 4 database using massive.

the pgadmin4 creditentails given to me are placed in a .env file. i passed the credentials through the massive method like so

const {PORT, SESSION_SECRET,DBHOST,DBPORT, DBUSER, DBPASSWORD,DATABASE,DBSCHEMA} = process.env

massive(DATABASE,DBUSER,DBPORT,DBPASSWORD,DBHOST,DBSCHEMA).then(db => {
    app.set('db',db);
    console.log("db listening")
})

however when I do that i get this error

loader[key] = getFilterString(loader[key]);


TypeError: Cannot create property 'blacklist' on string 'CBASYNCMSGQAUSEAST1ADMIN'
    at C:\Users\anabaco\AppData\Local\Programs\Git\workspace\assurion_session\node_modules\massive\lib\database.js:58:17
    at Array.forEach (<anonymous>)
    at new Database (C:\Users\anabaco\AppData\Local\Programs\Git\workspace\assurion_session\node_modules\massive\lib\database.js:57:86)
    at module.exports (C:\Users\anabaco\AppData\Local\Programs\Git\workspace\assurion_session\node_modules\massive\index.js:32:11)
    at Object.<anonymous> (C:\Users\anabaco\AppData\Local\Programs\Git\workspace\assurion_session\server\api-server.js:25:1)
enter code here

How do I connect my massive connection to my pgadmin4 database using these credentials?

Upvotes: 0

Views: 344

Answers (1)

jeeves
jeeves

Reputation: 2031

As per the docs. Pass an object with the correct key / value pairs to the massive function.

const massive = require('massive');

massive({
  host: '127.0.0.1',
  port: 5432,
  database: 'appdb',
  user: 'appuser',
  password: 'apppwd'
})

Upvotes: 0

Related Questions