Monday 8 May 2017

How to connect PostgreSQL to NodeJS right way?

I can't understand how to connect PostgreSQL pool in NodeJS and do it correctly. I am using Express with Router, all handlers are placed in different files. Everyone advises to make a separate file with a DB connection and then "require" it in each source code file. Is it possible to connect this pool through app.use or something else? All my handlers always use DB connection, for each user request.



via Alexey Rodionov

No comments:

Post a Comment