How to connect to a Postgres database using URI in a Node JS app?

Muhammad - May 27 - - Dev Community

You establish the connection to a Postgres database using its URI by writing the following piece of code:-

const connectionString = 'postgresql://dbuser:secretpassword@database.server.com:3211/mydb'

const pool = new Pool({
connectionString,
})

. . . . . . . . . . . . . . . . . . . .