Node.js hello world on Windows
1] Download node.exe
Location: https://github.com/tjanczuk/node/downloads
Default installation: C:\Program Files\nodejs
2] Write helloworld.js javascript file:
var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Hello World\n’);
}).listen(8124, "127.0.0.1");
console.log(‘Server running at http://127.0.0.1:8124/’);
3] Run
(In dos): Run node.exe helloworld.js
Console should be saying: ‘Server running at http://127.0.0.1:8124/’
4] Call from browser
http://127.0.0.1:8124/
More info: http://www.nodebeginner.org/
Advertisement
No comments yet.
Leave a Reply
-
Archives
- November 2011 (1)
- October 2011 (1)
- September 2011 (1)
- May 2011 (3)
- March 2008 (4)
-
Categories
-
RSS
Entries RSS
Comments RSS