When connecting a web application in Node to a PostgreSQL database, we use a connection string. In this blog post we will break down the connection string and explain each part.

Suppose we have the following connection string: postgresql://postgres:postgres@mypsqldb:5433/bookmanagement?schema=public

Here is what each part means:

  • postgresql - This is the protocol/driver that is used for the connection.
  • postgres:postgres - This is the combination of the username and password.
  • mypsqldb - The hostname or server address.
  • 5433 - The port number.
  • bookmanagement - The name of the database to connect to.
  • ?schema=public - A query paramater that specifies to use the “public” schema in the database.