Jesse Lawson

Software engineering, artificial intelligence, writing, and open-source tools

Jan 1, 0001 - NodeJS Tutorials

Getting Started with Node.js on Windows

Warning: you’re about to install node.js and an http server in less than twenty seconds.

The future of web development lies in technologies like Node.js. For those of us stuck on Windows and developing for tomorrow’s bleeding-edge content consumers, I’d like to walk you through a very simple setup that I went through in order to 1) get Node.js installed on my Windows 8 machine, 2) organize my development environment (i.e., make a folder), and 3) install an http server to get up and running.

At the end of this tutorial, you’ll have a complete node.js environment setup with a fully functional http server to develop with locally.

Installing node.js

This couldn’t be easier. Head to the node.js download page and select the appropriate installer; follow the on-screen instructions; restart your computer when it’s finished installing. That’s it!

Select a folder

For the final step, you’ll need to select a folder from which to serve all your files. Since we’re developing locally, maybe use something like C:/Development, or something like that. Just make sure you remember where it is.

Install the http-server

Head to your command prompt and type in the following command to install the http server:

npm install http-server -g

You’ll see a bunch of lines on the screen that will show you it’s downloading some files, then you’ll be back to the command prompt in no time.

To start the server, simply type in the following:

http-server C:/Development

You’ll see a confirmation and then a reminder that you can terminate the server by hitting CTRL+C.

Test your new http server

Head to localhost and remember to use port 8080 (or just click on that link).

Voila! Your own lightweight http server in node.js, written for and in the environment that you’re about to work in (JavaScript!).