Why Node ?
You may have heard, in the past few years, about [NodeJS][1], a relatively new server-side language.
Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.[1]
I[2] have been trying it for several months now. Before that, I nearly exclusively used PHP for my web projects, and I was happy with it. But when I heard about Node, my curiosity made me move outside my comfort zone and try the thing.
And I am now convinced that Node is the future in Web development.
About NodeJS #
Here are the most important things one need to know about Node :
- Node is plain Javascript: You read it well. With Node, no need to switch between languages when you are working on both the front-end and the back-end of your website. Your Node code will look (pretty much) like your usual javascript, or jQuery. And this is incredibly good for developpers.
- Node is fast. Like really fast: Here, You’ll have to take the word of people more experienced than me. Take the devs at LinkedIn Mobile, for instance. They moved their infrastructure from Ruby on Rails to Node. They went from running 15 servers with 15 instances (virtual servers) on each physical machine, to just four instances that can handle double the traffic. And the app is now 2 to 10 times faster[3]. Walmart has had amazing results too[4].
- Packet and dependencies management is easier than ever: Node is relying on
npm
, a packet manager, to ease development and aggregate all open source modules and frameworks from the community. And it works just as expected : seamlessly.
Quick example : a simple web server #
The following code is using [Express][4], a npm module that offers high-level resources for building webservers.
var express = require('express');
var app = express();
app.get('/hello.txt', function(req, res){
res.send('Hello World');
});
var server = app.listen(3000);
5 lines, and the server is up and running.
Wanna know more ? #
Head [here][5] for the official website, where you can download and install Node.
Here are some nice resources for beginners :
- [The Node Beginner Book][6], a nice, free tutorial for beginners
- [Felix’s Node.js Beginners Guide][7], another tutorial for beginners
- [Building Node Applications with MongoDB and Backbone][8], in which you build a social network prototype from scratch.
[1]: Extracted from NodeJS official website.
[2]: Nicolas speaking
[3]: Source : VentureBeat | How LinkedIn used Node.js and HTML5 to build a better, faster app [https://venturebeat.com/2011/08/16/linkedin-node/][2]
[4]: Source : VentureBeat | Why Walmart is using NodeJS [http://venturebeat.com/2012/01/24/why-walmart-is-using-node-js/][3]
[1]: nodejs.org “node.js”
[2]: https://venturebeat.com/2011/08/16/linkedin-node/
[3]: http://venturebeat.com/2012/01/24/why-walmart-is-using-node-js/
[4]: www.expressjs.com
[5]: www.nodejs.org
[6]: http://www.nodebeginner.org
[7]: http://nodeguide.com/beginner.html
[8]: http://shop.oreilly.com/product/0636920026587.do