So Node js is a run time environment for javascript before we dive into Node js lets us understand How does our Javascript work? Javascript works in the browser because of javascript Engine like in chrome browser we have a V8 engine, in Firefox spider monkey is present. So the main challenge is how we can run the javascript outside the browser. Then there was a scientist named Ryan Dahl who developed Nodejs what he did that he took V8 Engine and embed it with C++ and this project is called Node Js. So node js is not a library or not a framework it is a runtime environment for javascript.
The Most important topic is how node js works. Let us explain by an example When a client creates a request then that request goes to the event queue and then all request will go To the event loop , the event loop is a kind of loop that always keep an eye on an even queue for Request and all requests will be handled by event loop by FIFO principle (first in first out) Means client 1 will request and his request will be handled first and he will get the response. So when the event loop picked the request it will observe that these requests can be of two types Blocking and Non-Blocking Request. If a Non-blocking request is picked then it will be processed and a response will be sent but when a Blocking request is picked then it will go to Threadpool, now the question is what is Threadpool? A thread pool is a kind of pool in which all workers are there and the thread pool will find the workers and assign the worker for the request .
To install node js navigate through the https://nodejs.org/en and download it.
it is called a node version manager it is open source by which developers can switch the node versions on their machine and according to their project requirements.
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”
brew install nvm source $(brew --prefix nvm)/nvm.sh
nvm --version
nvm install --lts
nvm ls
nvm use 14.15
In the above article, we explore what is node js , how nodejs works, and its installation
In simple words nodejs is run time environment for javascript it was developed by Ryan Dahl and embedded in the C++ and v8 engine and this project is called Nodejs.
You can install nodejs on its official website or by nvm following the above steps.
Wеlcomе to Scribblеrsdеn: Whеrе Words Comе to Lifе! Wе arе a vibrant community of writеrs, making languagе fun and forging connеctions. Explorе our world of crеativity today!
Recommended For You.....
Subscribe Us
Always Get Notified
Alert
Leave a Reply