I'm trying to get my head around where Node fits in. It's niche, so to say... What obstacles is Node aiming to provide a ramp for?
I've read through the examples and seen a few demonstration videos. And it all looks very slick... Creating a simple web server; creating a simple TCP/IP chat server; using Node as an JSON-based front for a database server... But where does it fit in? I mean, except for the last example, what is there to do with Node?
I guess what I'm asking is this: What would you use Node for? And why?
Convince the Boss
List of reason to use node:
Libraries and tools that can be used with node.js:
All of these libraries are based on the fact that node.js allows you to handle everything on a low level manner and that communication with the client is smooth and streamlined because you use the same language on either end.
The selling point for me is that I have the same MVC library backbone.js on the client and the server. All my model code is re-used. The models on the client and the server are synchronized trivially over now.js.
My database access is driven by cradle (or mongoose) which is all written in JavaScript. Actually my MVC ties directly into the database and seamlessly saves my models. The models define useful methods like save
and fetch
to do persistent database storage. I don't manually touch the database because my MVC allows me to plug-in in a database driver to do this for me.
The rendering of my templates is done with EJS, my views are shared among the client and the server. There is simply a large amount of code-reuse and my entire web development is done in JavaScript which means I don't have to switch my coding paradigm or style.
Nor do I have trouble deciding how I should handle the grey area between what lives on the server and what lives on the client because that grey area has been completely smoothed over and the client and server integrate seamlessly.
If you're going to write a complex dynamic ajax web application then node.js is a perfect candidate. If you're going to have a static website then node.js is a perfect candidate (You set it up in 20 minutes).
If you're going to write a server heavy website with little client side functionality and postbacks then maybe you're better off using php or ASP.NET. But if you're doing that you should looking into more dynamic client side functionality and using ajax.
I believe that one of Node.js's proclaimed strong points is it's suitability as a websockets server. Connections in Node.js are cheap (because there's very little framework around it), and therefore a single system can support many persistent connections.
well node is suitable for maintaining high amount of open connections (to other nodes, services & etc.) in general.
this should give you insight on its performance compared to others(+ a discussion as bonus): Scale Stack vs node.js vs Twisted vs Eventlet
Node also fits well as shell/terminal scripting language, good example is this: github.com/indexzero/forever
And as javascript @ server-side solution - shrinks the gap between building frontend (html/js) & backend (in current case nodejs) solutions.
You can find this useful too: List of Projects, Applications and Companies Using Nodejs
You can get a lot of node.js use cases if you look at the modules page for example. It varies from tons of libraries like routers, static file servers, web frameworks and WebSockets servers to lots of DB specific connectivity modules, standalone databases, TCP/IP servers and popular protocol/library wrappers which are all waiting to be used for building other madness like these companies did.
I would say you would want to use node.js in case when you want to take advantage of lightweight, low level and fast server side framework which is using evented IO and offers rich set of open source community driven libraries (you should, or rather have to, also know JavaScript to certain level) in order to build other modules or use it as a foundation for standalone project (or as a supplement for specific functionality which node.js can do better than other solutions).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With