We are using the node-postgres (pg
on NPM) for our app but were having issues so we decided to go back to the examples on the Wiki:
When we run the example, each http request inserts two records into the Postgres ("visit") table. Is this the desired behaviour...?
We published the example code to Heroku: https://node-postgres-example.herokuapp.com
(Note: Visit using Google Chrome)
Note: we made 3 changes to the server.js
code from the Wiki to make it run on Heroku this is on GitHub: https://github.com/dwyl/postgres-connection-pool-test
(the changes we made to server.js are purely to (1) create the visit
table if it does not already exist, (2) to get the postgres connection string from process.env.DATABSE_URL
and (3) to listen on process.env.PORT
on Heroku. all the rest of the code is as per the Wiki example)