Run Node server in the windows pc within few steps
Step 1. Download the file "node .exe" from http://nodejs.org/dist/v0.6.0/node.exe. Its just less than 5 Mb

Step 2. Save the file. Lets do it on "e:/node" folder.

Step 3. Create a new file -Lets say "server.js" on same location and Add the following Codes
var http = require('http'); http.createServer(function(req,res){ res.writeHead(200,{'Content-Type':'text/html'}); res.end(' <h1>Hello World!! Your HTML text goes Here</h1> '); }).listen(8000); console.log('Server running at http://localhost:8000');

Step 4. Now open the "Command Prompt" and type 'node file_name' i.e "node server.js"

step 5. Click on 'Allow access', then Open the browser and type the link http://localhost:8000

(note: Press Ctrl+C to terminate the server)
Isn't it Easy???
Happy Coding!!!
No comments:
Post a Comment