Download and Install Node.js
We can download Node.JS server for windows from here . Nothing to configure... Just download and install it. You can check whether you have installed it correctly using command prompt. Type node and press Enter you will get the node prompt. Host the sample script
This is the sample code for hello world server.
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/');
Create new text file and save above code as sample.js Run Sample Server
Then go to your folder (using command prompt) which has the sample.js file and execute it using node by executing command node sample.js
Access It Using Browser Open your browser and enter the address we have given in the sample.js file.
That's It !
I will go more detail in to node.js and socket.io in the next post :).