Guest User

Untitled

a guest
Sep 7th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. const { Pool } = require('pg');
  2.  
  3. const { DATABASE_URL } = process.env;
  4.  
  5. // if the url for the database is in process use that,
  6. // usually when using heroku or similar to deploy
  7. if (DATABASE_URL){
  8. console.log("Using database url");
  9. var pool = new Pool({
  10. connectionString: DATABASE_URL
  11. });
  12. }else{
  13. console.log("Using database info");
  14. var pool = new Pool({
  15. user: 'username',
  16. host: 'localhost',
  17. database: 'database_name',
  18. password: 'my_password',
  19. port: 5432
  20. });
  21. }
Add Comment
Please, Sign In to add comment