Node.js is a JavaScript runtime built on Google Chrome's V8 engine.
From the Node.js website:
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.
What's the big deal?
When we talk about JavaScript, most people will think about client-side scripting in browser.
With Node.js, you can do server-side coding, with JavaScript.
Imagine you can create an HTTP server with just a few lines of code:
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
Put this code in a file, say myWebServer.js, and you can start running this web server by executing this command in command prompt:
node myWebServer.js
Of course, it is not just about creating a web server. You can put business logic, data access, or anything else that you would typically put in your server-side coding.
If you are familiar with Ruby or Python, this should not be strange for you. The concept is similar; the difference is only the language.
It's been a long wait...
I first heard about Node.js back in year 2010 or 2011, when it was version 0.3.x.If you visit my Google profile or LinkedIn profile, or if you know me well enough, you would know that I have always been a Windows / .NET developer (read: I don't use Linux, though I played around with Ubuntu a lilttle bit before).
And Node.js at that time had always been a pain to make it play nicely with Windows. You had to install Cygwin, which makes your Windows act like Linux; and there are quite some complicated steps which are enough to deter me from installing it into my own machine. Just look at this post to see how difficult it was.
I did not look into Node.js anymore until last month when I accidentally found out there is finally an official Node.js version 0.8 Windows installer. And it comes bundled with npm, a package manager for Node.js. Sweet!
The Node.js Windows installer was first available since November 2011. I should have subscribed to their news or blog earlier.
With Node.js installed in my machine, I have a lot more to play with now. Can't stop my curiosity itch!
I encourage you to play with it. Head over to nodejs.org and download the installer. The installation is painless and takes just a few minutes. Don't forget npm - there are a lot of useful modules that you can make good use of.
In the future, I'll post more of my experiences playing with node.js. Stay tuned.