Node Js Architecture

what is node js?

A Runtime Environment for  executing Javascipt code

we know every browser has it’s own javascript engine and it takse the javascript code from the web application and convert into the machine code.

in 2009 Ryan Dahl got a great idea. so he took google chromium v8 engine and embed some c++ program to create Node.exe. so node is the runtime  environment for javascript. it  contents javascript engine to execute javascript code. But it also have certain c++ objects that provide an environment to execute the code. for example we don’t have Document.getElementById('') in this environment. instantly have other more interseting objects to more capability to the application.

fs.readeFile()
http.createServer()

Node is not a programming language.

Node is Not a framework

How Node Works

Highly-scalable,Non Blocking data-intensive and real time apps

non blocking – asynchronous

what mean by asynchronous. image  you go to restaurant. waiter comes to the table1 and takes your order and gives it to the Kitchen.then waiter go to the next table2 and takes his order and gives to the kitchen while the chef preparing meal.so the same waiter can serve many different tables. they don’t have to wait for the chef. this is what we call non-blocking asynchronous architecture. and this is how node application working. a waiter is like a thread  allocated to handle requests. so single thread is used for handle multiple requests.

Installing node js

you can go to the node js official page and download the latest version and install. if you are using linux you can use the following command to install the linux version of node.

On Arch Linux and its derivatives like Antergos, Manajaro Linux, run the following command to install it:
$ sudo pacman -S nodejs npm

On Debian, Ubuntu, Linux Mint:
$ sudo apt-get install nodejs npm

On RHEL, CentOS, you need to enable EPEL repository first.
$ sudo yum install epel-release

On Fedora:
$ sudo dnf install nodejs npm

if you are installing node js successfully. you can check on your command line as node -v and it gives the version that you  installed node.

0 0 votes
Article Rating

by kushan


Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments