brianc / node-postgres-docs

Documentation for node-postgres
https://node-postgres.com
MIT License
97 stars 94 forks source link

Slight documentation error #44

Closed JMurrin closed 4 years ago

JMurrin commented 5 years ago

Hey Brian,

I noticed a slight documentation error with your client example and attached my proposed fix below it. Current:

  const client = new Client({
  host: 'my.database-server.com',
  port: 5334,
  user: 'database-user',
  password: 'secretpassword!!',
})

Fix:

  const client = new Client({
  database: 'my.database-server.com',
  port: 5334,
  user: 'database-user',
  password: 'secretpassword!!',
  connectionString: 'postgres://user:password@host:port/database',
})

Hope this helps!

charmander commented 5 years ago

You would use either

const client = new Client({
  host: 'my.database-server.com',
  port: 5334,
  user: 'database-user',
  password: 'secretpassword!!',
})

or

const client = new Client({
  connectionString: 'postgres://user:password@host:port/database',
})

but not both.