Freelance Web Developer

Static Web Hosting, made easy

Nov 23, 2012

Write and run your first nodejs app on Windows

Node.js is a server side software system designed for writing server side JS. Node.js was created by Ryan Dahl starting in 2009, and its growth is sponsored by Joyent, his employer. Getting started with nodejs is easy.

Simply follow these simple steps:-

Step 1. Download and install nodejs for window. It will install Node and npm. And will be accessible from cmd.exe.

Step 2. Open command prompt and create a app directory, go to the directory.

 (i) Create a file called package.json:

  "name": "hello"
, "version": "0.0.1"
, "dependencies": {
    "express": "latest"

(ii) run npm install to install Express:

npm install

This will read the package.json in the root of the app and download all of the dependencies that you are missing.

(iii) Make a file that contains a simple app index.js:

var express = require('express')
  , app = express.createServer();

app.get('/', function(req, res) {
  res.send('Hello World !');


Step 3. Run it with

node index.js

and visit http://localhost:3000/ in a browser. You should see "Hello World !".

Labels: ,

By :