To fix ECONNREFUSED for Postgres on Node.js with error Docker, we make sure the connection string is correct.
For instance, we write
DATABASE_URL: postgres://username:pgpassword@db:5432/mydatabase
to set the DATABASE_URL
environment variable to a connection string for postgres.
We add the username and password with the database name in the string.