DEV Community

Muhammad
Muhammad

Posted on

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

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,
})

Top comments (0)