How to use node-postgres in node.js?

I'm new and poorly understood right I do. Nowhere else to ask )
OK, I hooked up the dependency npm i pg. created the file db.js with the connection settings.

in the file routes.js call db and make the query run successfully.
Do I need to close the connection or what ? If I have many controllers to the ranting
and every time I call db - creates a new instance of a connection after all.
June 14th 19 at 19:04
1 answer
June 14th 19 at 19:06
Look at strontium
Just what you need.

Find more questions by tags Node.jsPostgreSQL