There appears to be a lot of documentation (e.g. https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js, but also elsewhere including this site) indic
var express = require('express');
var app = express();
const pgp = require('pg-promise')();
var connectionString = "";
var parse = require('pg-connection-string').parse;
try {
var connectionString = "postgres://USERNAME:@localhost:5432/DBNAME";
var config = parse(connectionString);
config.password = "PASSWORD";
var dbcon = pgp(config);
app.set('dbCon', dbcon);
}
catch (error) {
console.log("DB error")
}
module.exports = app;