Trabla: node.js "Hello World" app on Win 7
Solving:
1. Goto http://nodejs.org/download/
2. Download and install Windows version
3. Create folder structure on disk C
C:\nodejs_projects\helloworld
4. Create file helloworld.js in folder C:\nodejs_projects\helloworld
5. Put code into helloworld.js file and save
var http = require('http');
http.createServer(function(req, res){
res.writeHead(200, {'content-type':'text/plain'});
res.end('Hello World');
}).listen(9003);
console.log('Nodejs Server is running on port 9003!');
6. Run windows command line
7. Execute following commands in command line
cd C:\nodejs_projects\helloworld
node helloworld.js
8. Open browser and goto url
http://localhost:9003/
No comments:
Post a Comment