Установить пакет pg .
const pg = require('pg');
const db = new pg.Pool({
host: 'SERVER_IP',
database: 'DB_NAME',
user: 'USER',
password: 'DB_PASS',
port: '5432'
});
db.query(“CREATE TABLE TABLE_NAME(id SERIAL PRIMARY KEY, xzy VARCHAR(40) NOT NULL,
abc VARCHAR(40) NOT NULL)”, (err, res) => {
console.log(err, res);
db.end();
});