Hello Node.js

Imagine downloading a library, creating a file, executing that file, and having a web server up….all in 5 minutes.  Say hello to Node.js.

I’ve recently been seeking new ways to rapidly develop new and exciting web services.  I have a couple prototypes running on Apache and Tomcat servers.  I began looking for something new.  Node.js is that new something.

What is Node.js?

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.


I couldn’t have said it better myself.  Node.js essentially turns the server-side scripting language, JavaScript, into a powerful programming tool.  It uses the Chrome’s V8 JavaScript runtime to execute Javascript.  Because of this, it is fast.

Once you download the Node.js, you can have a webserver up and running in a matter of minutes by executing a .js file containing the following.

http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");

At a high level, Node.js runs one thread.  For long running tasks such as database queries, file system operations, etc., using asynchronous, non-blocking methods allows for powerful, yet simple web server.

One of the best tutorials I have run across is The Node Beginner Book by Manuel Kiessling.  The tutorial takes you through the process of creating a simply web service very quickly, all while doing a great job explaining some of Node.js (and Javascripts) execution intricacies.  This is definately a must learn for anyone looking for something new.

I uploaded all of my source from the tutorial to my GitHub.  Please feel free to take a look at it, use it, fork it, etc.