I am using pg-promise to work with nodeJS and postgres, but when I try to query my User
table, it retrieves the superUser. I think it is related to the fact that I don't have a schema set yet, so the code searches on the default 1. How can I set the schema on the code?
I tried this:
var express = require('express');
var app = express();
const PORT = 8080;
var pgp = require('pg-promise')(/*options*/)
var db = pgp('postgres://postgres:randompassword@localhost:5432/appname')
app.listen(PORT,function() {
console.log("listening to port: " + PORT);
})
db.any('SELECT * FROM User')
.then(function(data) {
console.log(data);
})
.catch(function(error) {
console.log(error);
});