Change your connection code to use ssl. Following your linked example:
var conString = "pg://admin:guest@localhost:5432/Employees";
var client = new pg.Client(conString);
client.connect();
becomes:
var client = new pg.Client({
user: "admin",
password: "guest",
database: "Employees",
port: 5432,
host: "localhost",
ssl: true
});
client.connect();
https://github.com/brianc/node-postgres/wiki/Client#new-clientobject-config–client