3 Years
Discussion Span
Last Post by Squiva

Here is how you can start in 10 minutes or less. (Windows)

1 - 3 minutes : download and install your flavor.

4 - 5 minutes : open command prompt assuming your installation is on windows and on c drive. cd to the nodejs directory

C:\>cd nodejs

hit enter and then type


let's exit for a moment by pressing ctrl + c twice to go back to nodejs directory.

6 - 10 minutes : create a new file test.js in C:\nodejs\test.js. Copy and paste codes below and save your changes.

console.log("Welcome to my first NodeJs Program");

go back to your terminal and type

C:\nodejs>node test.js

hit enter and you should get something like this

C:\nodejs>node test.js
Welcome to my first NodeJs Program

In addition to cereal's recommendation read this great tutorial. Read the Doing Something Useful - HTTP Server paragraph.

Once you have immersed with the syntax, try reading Doing Something Useful - Express it is about the express framework. Make sure to always follow these simple protocols and you won't get lost.

Practice and read Pro Node.Js for Developers from Appress written by Colin J Ihrig, Andy Ihrig.

Edited by veedeoo: more info added

Votes + Comments
good suggestions!

I want to add
if you follow the tutorial, You need to change the port number

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');

console.log('Server running on port 8080.');

Just change the 8080 to something different to prevent any conflict with WAMP, XAMPP, UNIZero and others.

test on port 9999, then type on your browser http://localhost:9999. By setting it up like this you can still use the http://localhost/ for your PHP server.

This is how I set my development servers Apache port 80; Nodjs port 92; Python port 95

Edited by veedeoo: more info added


First, you must intall Node.js. After that, you create a new JS file, and put this in it...

var app = require('express')();
var http = require('http').Server(app);

app.get('/', function(req, res) {
    res.sendFile(__dirname + '/chat.html');

http.listen(3000, function() {

Then, you must create an HTML file to be displayed.

  #msgs {list-style-type: none; background: #99CCFF}
      <ul id="msgs"></ul>

Once you have done that, you are all set to run it. To run it, you must open your command prompt, then go to the directory where you stored the JS file. After this, you must type in your command line, "node YOURFILENAME.js"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.