node-postgres vs pg-promise for Nodejs Application
Asked Answered
I

1

25

I'm going to build a Nodejs application with Postgresql as back end. I'm not going to use ORMs like Sequelize due to poor documentation and performance problems or any other ORM - ORM is an anti-pattern.

I found node-postgres and pg-promise are candidates in this regard. So, can anyone clarify the scenarios which one of the tools is better than the other or which one is way to go with description, provided that node-postgres has been developing since 2010 and pg-promise since 2015.

Ingleside answered 24/10, 2016 at 8:0 Comment(0)
V
48

pg-promise uses node-postgres internally. AFAIK pg-promise is a promise-based set of higher-level APIs on top that you might find useful. I'd recommend using whichever you feel more comfortable with. I'm the author of node-postgres.

Vivle answered 24/10, 2016 at 14:9 Comment(8)
@brainc I know you're the author of node-postgres. I heard that a high-level API is something that is easier to use, is that correct?Ingleside
@AbdihafithKhalif that is generally the notion of higher-level, LOL.Softy
Ah, Thanks @vitaly-t, any other details you would like to add this answer?Ingleside
@AbdihafithKhalif Ahem, I'm the author of pg-promise, not that it matters here, but you weren't specific either :)Softy
"So, can anyone clarify the scenarios which one of the tools is better than the other" ? Just quoting the line from the OP that has not been answeredDecorum
@Decorum pg-promise documents what it adds on top of the base driver.Softy
@Vivle could you also tell whats the difference between 'node-postgres' and 'pg'? They seem to be same, then why two different npm packages?Dinorahdinosaur
pg is higher on downloads than pg-promise , i prefer the light weight pg.Coriecorilla

© 2022 - 2024 — McMap. All rights reserved.