Setting up HTTP server on Windows with Node.js

Some years ago I dreamed about running JavaScript applications on Windows systems as easy as it was on Linux. It seems the future is here.

Today it’s really easy to setup Node.js and install NPM apps on Windows systems. Here’s a guide how to setup a HTTP server. No programming skills required! (Basically it’s the same process for any OS!)

  1. First you must install NodeJS.
  2. Open the command prompt to run following commands.
    • Windows 7: Open Start and write cmd into the search and press enter.
    • Windows XP: Open Start and select Run and write cmd and press enter.
  3. Run this command to install a HTTP server: npm install http-server -g
  4. And start the HTTP server: http-server /path/to/docroot with a path to the folder you want to share. Your folder must have some files before it works.
  5. Now just open http://localhost:8080/ in your browser.

I wonder if there is a GUI for NodeJS/NPM yet. However I don’t think running some simple commands is so hard thing to do.

NPM isn’t just for installing HTTP servers. There’s a lot of apps and libraries available and ready to be installed with APT-like interface. You can even publish your own software there!

About jhh

Programmer, business owner and a system admin. I post about books, business, Internet, technology and pretty much anything interesting, too.
This entry was posted in Programming, Software, Web development & design and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to Setting up HTTP server on Windows with Node.js

  1. Pingback: CG:SKEELOGY - Google Summer of Code 2013 Week 1

  2. Excellent tip! On a Mac, there is a built-in web server that can be fired up with a single command (see: Start SimpleHTTPServer from any folder on a Mac), so I was looking for a similar, simple solution for Windows. This does the trick. Thanks for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti-Spam Quiz: