Node.js on Windows and Azure

Image

Node.js is a server-side JavaScript environment that uses an asynchronous event-driven model. This allows Node.js to get excellent performance based on the architectures of many Internet applications

Node.js is a software system designed for writing highly-scalable internet applications, notably web servers. Programs are written in JavaScript, using event-driven, asynchronous I/O to minimize overhead and maximize scalability. Node.js consists of Google’s V8 JavaScript engine plus several built-in libraries.

For more information, visit:
http://nodejs.org/

Node.js was originally available for Linux, but now available for Windows as well. This tutorial talks about getting started with Node.js on windows and Azure.

First step in getting started with Node.js on windows is installing latest Windows Azure SDK for node.js on Windows from:

http://www.windowsazure.com/en-us/develop/downloads/

Image

Image

Image

After node is installed, we need to test if it is installed properly. For that write this simple script and save it in a file at any location, say, C:\NodeProject\NodeServer.js

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/');

I just copied this script available at nodejs.org website.

Now, open command prompt and navigate to the directory and run
node NodeServer.js

You get the following response:
Server running at http://127.0.0.1:1337/

Image

Let’s check in the browser if we get the response
Go to http://localhost:1337/

Here you go! You get the response: Hello World!

Image

Next part of the series will cover running Node on Windows Azure.

Advertisements

One thought on “Node.js on Windows and Azure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s