Hacker News new | comments | show | ask | jobs | submit login
Node.js: the good, the bad, the ugly - why the hell would you use it? (toptal.com)
13 points by zappan 1409 days ago | hide | past | web | 6 comments | favorite

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.

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

Own a business, starting up, or just want to convince your client, boss or the stakeholders why Node.js is the right way to go? Are you sure you are making the right choice, or need a supporting evidence? Lots has been written about Node.js, but people tell me they couldn't find it summarized in one place, so here it is - the good, the bad and the ugly of Node.js - if you fit in, just use it!

I'd add that node.js is even a good enough tool for heavy computation. Do not crunch the numbers in the main event loop, but spawn a worker-cluster and you're fine.

Do not forget that the raw speed of the V8 (not to mention C++ modules for more speedup) outperforms other current scripting languages like ruby.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact