Over a million developers have joined DZone.

Node.js on Windows (or JavaScript for the backend)

DZone's Guide to

Node.js on Windows (or JavaScript for the backend)

· Web Dev Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

What is Node?

The simplest answer, albeit a simplistic answer, is that Node (or Node.js) is JavaScript on the server. Actually, it’s a more than just that, but you can read about the more in other places. This is a good enough answer for us n00bs.

Unless you’ve been living in in cave, you might have noticed that JavaScript is all the rage now. It’s the new assembly language of the Web. (It’s even for the enterprise.) With Node, you can now take that webby clienty goodness to your server applications.

The reason I’m brining all this up is because there’s now a version of Node.js for Windows. It’s currently the unstable release only, but it’s a sign of coolness to come. Furthermore, Microsoft has partnered with Joyent and Rackspace to make it happen. You can read about it here and here. The ultimate goal (according to the posts) is for Node.js to run on both Windows and Azure.

Now, I want to be clear too, since I have been newly assimilated, Node is not a Microsoft product..


I want to show you how easy it is to try out Node.

First, download the exe. I grabbed v0.5.2.

Next, run it. Yeah, it’s that easy. It used to be way harder.

You’ll be presented with a prompt and you can start writing JavaScript in paradigm-shifting REPL.


Now, let’s say you want to create a web server. We’ll begin by yanking the ‘hello world’ snippet from nodejs.org.

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(8124, "");
console.log('Server running at');

I saved this snippet into a file named server.js. Then from a PowerShell prompt, I ran

 .node.exe .\server.js

node server

Next, I hit http://localhost:8124 with a browser and I got exactly what you’d expect.


Now you know enough to be dangerous. Winking smile

Of course, you have to restart Node when you make changes to the file (use Ctrl + C). I’ll show you how I got around that in another post.

Have fun!

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda


Published at DZone with permission of Christopher Bennage, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}