DEV Community 👩‍💻👨‍💻

Discussion on: Add PostgreSQL to Express Server

Collapse
 
heyrohit profile image
Rohit Gupta

This is amazing. Keep up.
My one cent though, for query execution, every time the method is called, a new instance of pg client is created. I guess this should be a global variable that should connect from a available pool of connections to execute.

Collapse
 
achukka profile image
Aditya Chukka Author

Hi Rohit,
Thanks for the suggestion. I agree, kept it simple for the sake of post, but in PRODUCTION, you should have a single instance of client per a single instance of service.