You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also prefer the simplicity of connectionString over manual configuration for dbConnection.js:
const{ Pool }=require('pg');constenvironment=require('env2')('.env');constDB_URL=process.env.NODE_ENV==='test'
? process.env.DATABASE_URL
: process.env.DB_URLTEST;if(!DB_URL){thrownewError('Environment variable DATABASE_URL must be set');}constpool=newPool({connectionString: DB_URL,});module.exports=pool;
Then in the config.env extra options like max and ssl can be supplied through query parameters at the end of the url:
Nothing major so feel free to ignore, but I prefer ternary assignment with
const
to if statements withlet
:vs
I also prefer the simplicity of
connectionString
over manual configuration fordbConnection.js
:Then in the config.env extra options like
max
andssl
can be supplied through query parameters at the end of the url:postgres://user:password@localhost:5432/databasee?ssl=1&max=18
The text was updated successfully, but these errors were encountered: