Quantcast
Channel: Techathon | Techathon
Viewing all articles
Browse latest Browse all 36

Node.js tutorials : Creating application with Node jS

$
0
0

There are several reasons to gaining popularities of node.js . If you are planning to create  application using node.js then first you will need to setup development environment .

Installing Node JS

Follow below steps to setup node.js development environment :

Step 1: Goto http://nodejs.org/ and click on install

Step 2: Download and install

Creating hello word with node.js

Step 1: Create a folder named “helloword” anywhere on your file system.

Step 2: In the “helloword” folder, create a file named server.js.

Step 3: Write below code in server.js :

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(3000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:3000/');

Step 4:  To start the server, open a shell, cd to your helloword directory, and start your server as follows:

node server.js

If you are using windows then open node.js command prompt (Start menu->All programs->node.js->node.js command prompt) and run here above command.

node-js-development-environment

Step 5: To test the application, open a browser and access http://localhost:3000

C$7.99 .COM Domains at Go Daddy

 


Viewing all articles
Browse latest Browse all 36

Trending Articles