// set the way we will connect to the server
const pgConnectionConfigs = {
user: '<MY_UNIX_USERNAME>',
database: '<MY_UNIX_USERNAME>',
port: 5432, // Postgres server always runs on this port
// create the var we'll use
const client = new Client(pgConnectionConfigs);
// make the connection to the server
// create the query done callback
const whenQueryDone = (error, result) => {
// this error is anything that goes wrong with the query
console.log('error', error);
console.log(result.rows);
const sqlQuery = 'SELECT * from cats';
client.query(sqlQuery, whenQueryDone);