Steps to Execute a Node.js Console Application.
- 1. download nodejs to your system.
- 2. open a notepad write js command "console.log('Hello World');"
- 3. save the file as hello.js preferably same location as nodejs.
- 4. open command prompt navigate to the location where the nodejs is located. ...
- 5. and run the command from the location like c:\program files\nodejs>nodehello.js.
2. Copy the file to
C:\
3. Create C:\hello.js
4.
Paste in the following content:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running
at http://127.0.0.1:1337/');
1. Save the file
2. Start -> Run...
-> cmd
3. c:
4.
C:>node hello.js
Server running at http://127.0.0.1:1337/
That's it. This was
done on Windows XP.
No comments:
Post a Comment