Restful Api express postgres database
问题 I´m developing a rest full api with node and exrpess, my database is postgresql, I need to use the postgres package pg-promise. I know that I need to connect my app with the database in the app.js file, but my question is, How I should use this connection in my endpoints. I have routes and I am using controllers. For example app.js //in this file, suppously I have to to the connection const db = pgp('postgres://john:pass123@localhost:5432/products'); app.use('/products', productsRoute);