Hacker News new | ask | show | jobs
by rpedela 4684 days ago
I strongly disagree with not using Node.js for "server-side web app with relational DB behind". I have used both the PostgreSQL and MySQL modules and they do just about everything you need. There is a module called "any-db" which makes transactions and connection pools a breeze.

It seems the author is specifically talking about ORMs. I have not used them in Node.js so maybe they are immature. Saying "don't use Node.js ORMs" is very different to "don't use Node.js with relational DBs". The former may be correct, but the latter certainly is not.

2 comments

I'm fairly new to web development, but I've been thinking about starting a Node.js project backed by a PostgreSQL database lately. I was planning on using express to create an API of some sort to do all the database queries and return relevant information in JSON, then create the website front-end with something like Angular and have it just communicate with the API returning the JSON. Is there a better approach?
Use node-postgres for the DB piece. If your server is just going to be a REST API then use node-restify. If you want the server to serve a website (html, css, js) then use express. I have not used Angular so I cannot comment.
You are right there, implying the use of ORMs as data mappers or active records, as that's a standard thing today. Doing raw database access is a thing most of devs would like to avoid these days as we have those better and proven patterns at hand. Still, I agree with your comment that it should be stated more clearly it's ORMs...