I tried the heroku node sample at: https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
And used Postgres as the db.
All worked.
Now I wanted to run it local, so I used the sample from: https://devcenter.heroku.com/articles/heroku-local
To get the DATABASE_URL to my .env file - but I couldn't get it to work even though when I ran Heroku local it displayed:
[OKAY] Loaded ENV .env File as KEY=VALUE Format
The database still did not connect and when I added:
console.log(process.env.DATABASE_URL);
It wrote undefined to the console.