Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm designing a web application that is locally focused on JSON objects to do all the data stuff (and after that I would pass it to a server to cloud synchronize). However, somebody in an answer from another question suggested me to use Node.js to up/download data directly formatted as JSON.

I read some stuff at the developer's website, and they claim it's as a web server. However, I'm not sure if it's just a data server (which makes sense to me) or it could be a replacement to Apache (I would go for no).

I'm aware that your answers depend on the needs of my application, so, to sum up: it should be able to dispatch data from a database ([No]SQL, whichever) and synchronize it back when I choose (either in the background or by direct action). The client-side should store the data as a mid-step (before syncing and after downloading the stuff) in JSON. Eventually in the future, it should need to synchronize across a bunch of accounts at the same time (you know, team modifications, just like Google Docs and so).

And now, back to the question:

Which are the pros and cons of Node.js?

I'm pretty sure that the direct use of JSON objects from the server to the client and the pushing calls are pretty good reasons to choose Node.js. However, I'm not sure if security (either my code or the data itself) or concurrent connections are mature enough, or I should go for a typical Apache with PHP files querying a MySQL, and in the early future poll instead of push (or find a pushing server).

I know the question may sound easy to answer if you're already on one side (just node, node+Apache, just Apache), but these days I'm from nowhere. Thanks for your answers, mates.

share
4  
Producing JSON responses is seriously one of the simplest problems for any modern web framework or language; it's an extremely simple format with good support (esp. outbound) in a zillion languages. –  Pointy Apr 14 '11 at 22:52
    
@Orbling how do I close it? –  Kor Apr 14 '11 at 22:58
    
@Kor: If people who have high reputation agree with me, they will vote to close - once it hits the required number it will happen automatically. –  Orbling Apr 14 '11 at 23:06
    
If you need actual push capabilities, why not simply use WebSockets? I'm unsure why you use middle-layer to transport data, it's up to you but if you can choose which browser your users will use to access your app - WebSockets ftw when it comes to pushing over the web. –  N.B. Apr 14 '11 at 23:07
1  
@Kor node is a complete HTTP server. Replace apache. Search the node.js tag for more information. –  Raynos Apr 14 '11 at 23:51
show 3 more comments

migration rejected from stackoverflow.com Sep 17 '13 at 14:38

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as too broad by gnat, Kilian Foth, TZHX, MichaelT, GlenH7 Sep 17 '13 at 14:38

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 1 down vote accepted

Pros: It is fast, easy to learn, scales well and generally lets you unify your client/server logic. Handles JSON very well. Generally good documentation for the libraries, and a solid community

Cons: As others have mentioned, it is not widely used. Finding competent developers, example code, working frameworks and feature-complete products is harder than with PHP, Java or .NET. The biggest downsides are probably related to the language (JavaScript) itself and the lack of native OO support, as well as the lack of compile-time error detection. Once more tooling exists, it will probably start to take off and really mature.

share
3  
JavaScript is Object Oriented language. It doesn't have native support for Classes, it has native support for OO. Please stop saying this about prototypical and other non-class based OO languages. It's like saying that French has no support for verbs, because it doesn't use English. –  nirth Aug 19 '13 at 9:33
    
I think the community is one of its strong points. Is finding developers really that hard for it? The community is solid and JS experience is a quite common. I won't argue that it is a widely "misunderstood" language. –  pllee Aug 19 '13 at 13:56
    
Contradiction: "easy to learn" vs "finding competent developers". –  Den Aug 20 '13 at 8:46
1  
@Den you're making arguments like it was 1995. JS has been under continuous development for a couple decades now. Beyond simple hover effects there has been nothing done in web UI without it that wasn't Flash since the '90s so I would say it's not very widely used as this whole internet thing has been kind of a big deal. Browser tools are excellent and I've never heard anything bad about Webstorm. You'd have a very weak argument saying it's not OOP by pointing out some wimpy definition that includes classes. You have no argument saying it's not OO. Functions and primitives are objects in JS. –  Erik Reppen Dec 23 '13 at 21:57
1  
^edit: "is VERY widely" not "is not widely" –  Erik Reppen Dec 23 '13 at 22:03
show 3 more comments

The biggest downside of node.js is that it's not yet widely used, so if you're looking for mature, tested solution, you should rather choose Twisted.

share
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.