[javascript] Starting a node.js server

I recently got into node and I installed it on my localhost. I am using WAMP. I am on Windows Vista.

Anwyay, I installed it. I made a new file in my localhost directory with this being called server.js

var http = require('http');

http.createServer(function (request, response) {
    response.writeHead(200, {
        'Content-Type': 'text/plain',
        'Access-Control-Allow-Origin' : '*'
    });
    response.end('Hello World\n');
}).listen(1337);

then I went to node and tried typing % node server.js and all I got was an ellipses. What gives?


UPDATE: I checked my Systems variable and saw that my PATH lists the node.js as C:\Program Files (x86)\nodejs\

enter image description here

This question is related to javascript node.js

The answer is


Run cmd and then run node server.js. In your example, you are trying to use the REPL to run your command, which is not going to work. The ellipsis is node.js expecting more tokens before closing the current scope (you can type code in and run it on the fly here)