#### What is Node.js?
Node.js is a brilliant platform for creating network applications. It is mainly known for its non-blocking I/O and event driven system. In simple terms, Node.js can easily handle a large number of requests while simultaneously consuming lesser server memory. These are the attributes make Node.js a better than other languages and platforms.
Why use Node.js?
Node.js comes with a built in HTTP server library. This means it doesn’t require the help of any external piece of software to act as a web server. Using Node.js alone one can have greater control of the web server parameters.
We will be installing Node.js on Ubuntu using Chris Lea PPA. The PPA will keep you will up-to-date to the latest stable version of Node.js depending on your Ubuntu release, The PPA might also download required dependencies depending on you Ubuntu install type.
There is a naming conflict with the node package (Amateur Packet Radio Node Program), and the nodejs binary has been renamed from node to nodejs. You’ll need to symlink
/usr/bin/nodejs or you could uninstall the Amateur Packet Radio Node Program to avoid that conflict.
Lets get it up and running!
- You need to update you local repository database by entering the command below.sudo apt-get update
- Adding the PPA.sudo add-apt-repository ppa:chris-lea/node.js
- Re-updating the local repository database to add the PPA to the local repository database.sudo apt-get update
- Installing Node.js using the PPA
This will also install NPM.
sudo apt-get install nodejs
#### Writing you first Node.js App.
- We need to create a file named
appis the name
- Add the lines given below.
You can visit
http://127.0.0.1:3000 to see the app in action.
Now we have Node.js installed on Ubuntu. If you have any problem feel free to leave a comment below.
I compiled a list of software and services that I use to improve my workflow, here is the link to the list.