Quantcast
Channel: Restful Api express postgres database - Stack Overflow
Browsing index pages (4 articles)
↧

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,...

View Article


Answer by Prasad for Restful Api express postgres database

I haven't used pg-promise.If it helps, you can use PostgreSQL client for Node.js. You can also use async/await with it.Instead of a router, you can use Express middle-ware straightaway as...

View Article


Answer by 1565986223 for Restful Api express postgres database

Here's an example how to use it:// mydb.jsasync function someDbQuery() { let result; try { result = db.any('SELECT * FROM products WHERE active = $1', [true]) } catch (e) { throw e } return...

View Article

Answer by vitaly-t for Restful Api express postgres database

You do not need to do anything, pg-promise manages connections automatically. It will be allocated for the query and released right after. See examples.

View Article
Browsing index pages (4 articles)


Latest Images