Skip to content

Instantly share code, notes, and snippets.

@sobinsunny
Last active August 30, 2019 07:20
Show Gist options
  • Save sobinsunny/a618e524bd6affe1bd5f4f34d9a316d4 to your computer and use it in GitHub Desktop.
Save sobinsunny/a618e524bd6affe1bd5f4f34d9a316d4 to your computer and use it in GitHub Desktop.
code for Knex connection establish with postgres.
const pg = require('pg');
const knexConfig = {
 client: 'pg',
 connection: {
  host : process.env.SQL_HOST,
  database: process.env.SQL_DB,
  user: process.env.SQL_USERNAME,
  password: process.env.SQL_PASSWORD,
 }
};
module.exports = require('knex')(knexConfig);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment