Home Logic Ubuntu (Linux) Blog

BocaJS: NodeJS + Postgres

NodeJS Code: Database Connection

******************
   ./database/
   db.js
******************

var pg = require('pg');

var db = new pg.Pool({
  user: "your_username_here",
  host: "localhost",
  database: "node_cms",
  password: "your_password_here"
});

  module.exports = db;