Reputation: 15034
I have a Hello.js file with following contents.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "mysite.com");
console.log('Server running at http://mysite.com:1337/');
I go to my command prompt, type in node...
How can i execute this Hello.js
in my node console
.
When i type node Hello.js
, i get .... alone
http://imageshack.us/photo/my-images/801/hellor.png/
Upvotes: 0
Views: 194
Reputation: 66170
your syntax is wrong, you need:
D:\Node > node Hello.js
What you're currently doing is starting an interactive session with node, i.e.
$ node
> console.log("hello"); # I typed this
hello
>
Upvotes: 3