Tag Archives: Node.js

node.js

Hello all , Hope you doing great! Today’s tutorial is very quick and short today will do some practical approach towards Node.js and its installation on windows and ubuntu operating systems.

As you we have discussed in our previous tutorial that what is Node,js and why it is so necessary to use it.If you haven’t learnt or see previous tutorial you can look http://androidarena.co.in/what-is-node-js-and-whats-the-use-of-node-js-part-1/ . So, Lets start quickly how to setup Node.js on Windows and Ubuntu .You can check out the video tutorial for this.

Lets start – On Windows

Windows is a very good operating system and installing a Node.js is very easy and a sweetcup cake . you have to go to

for 64 bit – http://nodejs.org/dist/v0.10.26/x64/node-v0.10.26-x64.msi

for 32 bit – http://nodejs.org/dist/v0.10.26/node-v0.10.26-x86.msi

Or simply you can goto http://nodejs.org/download/ and you can choose .msi format for your supported operated system.

installnode

 

Now After downloading just setup it like double click on downloaded file and press Next and then allow firewall if appears and finish.It means your node is installed successfully.Now lets check it node is installed or not .

Goto you cmd and type node -v .

cmd_node

If you see the version of Node it means your node is installed with this version.

Now on Ubuntu –

All those who are using Ubuntu can install it from repository by tying a command –

sudo apt-get install nodejs

Another Method to install it on Ubuntu –

Alternate Method to install on Ubuntu –

Install the dependencies by

sudo apt-get install g++ curl libssl-dev apache2-utils

–> Download Node.js from the given link  http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz .

–> Extract it on your desire directory.

–> Now switch to your location where you extract your files via terminal.

–>Enter the following commands .

./configure
sudo make
sudo make install

Now testing a “Hello androidarena welcome to node.js” on particular port number on localhost .

index.js

My port number is 3000 and we can see output at 127.0.0.1:3000 but first we have to open cmd and goto your directory where save your index.js .

cmd_server

 

And you can goto your browser and type 127.0.0.1:3000 and see the output –

Hello androidarena.co.in welcome to node.js .

So comment the section below if you getting any kind of errors and Next tutorial on node will be Connection with Android.

node.js

Hello all how are you? Today is going to be the best day because I am going to show you how to work on Node.js and how to install it on your operating systems.

First of all question arises on your mind that what is Node.js , why we are studying it and all but I am sure when you will learn its features you will see the power of Node.js.Basically Node is developed by Joyent Inc . and supported by Google also.

Lets take an example – Suppose their is one Handler at Coffee shop (NODE)with 3 co-worker and their is 3 customers A,B and C. 

A wants coffee and he asked for the same to Handler(NODE) with a one port number and Handler transfer this order to one of its co-worker . Immediately Handler will handle and will make order of B and C also and transfer their orders to its co-workers and then when order is complete then co-worker will output back to Handler(Node) and Handler will give back to customers , So in the above example we learnt that Their is no Deadlock occurs on Node I/O operations. and it is event driven.

So Quick start with What, why and How in Node.js .

What is Node.js and Why we are using it these days?

1). Node is Hottest technology for server side scripting and its work is same as PHP , ASP,JSP or other languages do but implementation and way of working is different from all tradition languages.

2).  It is server side scripting written in Javascript.

3). It has different modules to handle the operations  like express,socket.io,Http and all.

4). Better than any other language to code server side and it is very useful in Real Time Communications.

5). It is based on Asynchronous event driven framework and so that many connections can work simultaneously.

node.js_feature

 

6). Design for developing scalable Network Applications. 

7). Non-Blocking I-O model so that light weighted and easy to use.

8). Easy use with Json (Java script object notation) and connection with Android.

9). Upon each connection their is Callback will fire and if their is no connection then Node will go on sleeping mode.

10). Working on different Threads simultaneously is inefficient and difficult to use,and Node.js provide no deadlocking during communications.

11). It’s designed are influenced by Pythons Twisted and Ruby’s Event Machine.

12). So as we have learned that it is based on single Thread it doesn’t mean we can’t create multiple threads , Yeah ! that so interesting about  Node.js we can create multiple threads by making child processes and that are easy to communicate by using child_process.fork() built upon the same module clusture() .

13). Ajax Like stuff can be done on server side also. Best use in Chat Rooms,online Games etc . image source[learn2crack].

Feel free to ask anything and do subscribe us for more tutorials on Node.js with Android. Happy learning.