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
{{ message }}
Repository navigation
Document running a basic hello world on heroku #1342
const{Pool}=require('pg');constparse=require('pg-connection-string');constpool=newPool(parse(process.env.DATABASE_URL||'pg://postgres@localhost/postgres',{ssl:true,max: 2}));pool.query(`INSERT INTO hello(text) VALUES('world') RETURNING *`).then(({rows})=>console.log(rows)).catch(console.error)
I hope the one integrated in pg will look like it
I'd love to do:
const{Pool}=require('pg');// new Pool(opts) or new Pool(connectionString, opts)constpool=newPool(process.env.DATABASE_URL||'pg://postgres@localhost/postgres',{ssl:true,max: 2});pool.query(`INSERT INTO hello(text) VALUES('world') RETURNING *`).then(({rows})=>console.log(rows)).catch(console.error)
Activity
caub commentedon Jun 24, 2017
schema.sql
Run
heroku run "psql -U postgres -f schema.sql" --app your-apphello-world.js
Run
heroku run "node hello-world" --app your-applike this?
mariusa commentedon Jul 12, 2017
Hopefully connection-string support won't require another module.
caub commentedon Jul 12, 2017
I made a PR to make it simpler:
I hope the one integrated in pg will look like it
I'd love to do:
charmander commentedon Jul 12, 2017
https://node-postgres.com/features/connecting#connection-uri
caub commentedon Jul 12, 2017
ahh! nice, I'll test that, thanks