2

Currently I'm trying to learn what is node.js. I have installed node.exe in windows, don't know what is the next step to do some thing

Can you guys help me.

PCA
  • 1,677
  • 6
  • 28
  • 45

3 Answers3

5

You create a js file, write your code and start the server with node.exe path/to/file.js. After that you could open your Browser and have a look at the program.

Here a example (helloWorld.js):

var http = require('http');
var server = http.createServer(function(req, res) {
    res.writeHead(200);
    res.end('Hello World!');
}).listen(8080);

node.exe helloWorld.js

Open your Browser and look at localhost:8080

Also have a look at the documentation. Additionally you find on the developer page (at the bottom), an example how to set up a webserver.

Andre Hofmeister
  • 3,185
  • 11
  • 51
  • 74
1

You can use IIS Express to run nodejs on windows. Currently on Windows you can use webmatrix from http://web.ms/

Remember that you need to use X86 of node.exe even your system is x64, since IIS Express only ships as 32bit.

If you install webmatrix and try nodejs it's automatically configure everything for you.

Remember that if you not have installed nodejs then webmatrix will install old version for you.you need to manually install node.js from it's official website.

see justin's post http://jbeckwith.com/2012/06/07/node-js-meet-webmatrix-2/

http://www.microsoft.com/web/post/how-to-use-the-nodejs-starter-template-in-webmatrix

hope this help.

Michael Paulukonis
  • 9,020
  • 5
  • 48
  • 68
Anirudha Gupta
  • 9,073
  • 9
  • 54
  • 79
0

Since you are after learning and you are on a Win7 machine you can also host the node.exe in IIS. Perhaps you will find this guide helpful: http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx

Damyan Petev
  • 1,585
  • 7
  • 10
  • IIS is used for Production and their is no requirement for installing IIS when IIS express is available for development purpose. – Anirudha Gupta Oct 02 '12 at 08:20