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
your syntax is wrong, you need:
What you’re currently doing is starting an interactive session with node, i.e.