Video 1.4 out is no trick work. In this video, we will learn the working part of node red. You can take a guess, to how node red works from its name. Any guesses? Well, if you've said no gs 10, you're right. For people who don't know, let me explain what I'm talking about.
Node JS is an event driven, non blocking asynchronous model. It is a runtime environment for executing JavaScript code outside of a browser. Poof, wait, Lakshmana don't freak out. I understand your worries. Let me take you through all this step by step. No trade runs or no Gs.
You might ask me, What does no GS run on? I'll explain. JavaScript is a client side script. Adding language. When a user requests an HTML page with JavaScript in it, the script is sent to the browser, and it is up to the browser to do something with it. To understand this, go to your browser settings and turn off JavaScript and load YouTube.
What do you see? Nothing? Well, this is what happens when you ignore JavaScript. And that's why it is important. Okay, you said that it was up to the browser to do something with the JavaScript code, right? What will the browser do?
Every browser runs a JavaScript engine, which will convert the JavaScript code to machine code, which can be understood by the computer. Firefox uses an engine called spider monkey. Internet Explorer, uses chakra and chrome uses Viet engine and guess what we It is the fastest JavaScript engine. After 2009. JavaScript could be only used in browsers. In 2009, Ryan Dahl came up with an idea to execute JavaScript outside of a browser.
So he took the chrome VH JavaScript engine and embedded it inside a c++ program and called it node.xc. Unlike the normal objects like document in browses no GS includes objects like HTTP, to listen for requests at a given port. And we can read file systems using Fs etc. I told you before that no GS was a non blocking asynchronous model. Consider a waiter named Mike in a restaurant and a few guests occupying two tables. Mike goes to table one gets the order and goes to the kitchen.
To pass on this order, then he comes back to table two to take their order. Here, Mike is equivalent to a single thread allocated to handle a request. The two tables full of guests are equivalent to two requests. Here, a single thread is used to handle multiple requests. And that is why this model is called non blocking or asynchronous architecture. Here, while Mike is serving Table to Table, one might come up with another order, in which case, their request goes into what is called an event queue.
This will be continuously monitored by Mike. After attending table two, he will go to attend table one's request. And if there were more tables, all those requests will be stored in the event queue and he'll attend them one by one This is why no GS is called event driven. In contrast to this, in a synchronous architecture, Mike is allocated to only one table. And so he takes the order goes to the kitchen and waits for the food to be prepared. So if another table needs attention, Oscar, another waiter, another thread has to take care of it.
In this case, when the number of requests rises, we might be in a position where we run out of waiters to serve requests, in which case, we need to add another hardware to get more threads. This is why many companies like PayPal, Netflix, Walmart, etc. have chosen Node JS over other languages for running their websites. What I mean is due to the nodes asynchronous nature, they can handle more requests and because it is non blocking, it is lightweight in nature. And so the users can get faster response times. From this, it is understood that noches is ideal for IO intensive real time applications.
It is also highly scalable because of its asynchronous model, and also ideal for data intensive applications, because it is lightweight. In future videos, we'll understand why no dread runs or Node JS. For now, understand that the boxes we saw in video 1.2 are small package no GS functions. They take an input, work on that input and produce an output all done asynchronously. Each node offers different functionality. If you want a different functionality, you can add them using the NPM package manager, which comes along with Node JS, the node package manager provides two functionalities.
It provides online repositories for node j s modules, and a command line utility to install Node j s packages, do version management and dependency management of the packages. By default, any dependencies installed locally that is in the node underscore modules folder inside the directory when node application is present. All locally deployed packages can be accessed using the require method. You can also install a module globally using g flag during installation. In this case, the packages are stored in the system directory. These packages cannot be imported using the require function.
Then there is the file package dot Jason. It is the heart of a Node JS system. It gets contains the metadata of the application. You'll soon learn about it. For now, understand that package dot Jason contains version dependency information, script information, etc. Okay, we've reached the end of this video.
In this video, we have learned how no Drake works, which literally means how no GS works. In this section, we learned the following introduction to the course. Why you should even bother with no Drake. What is no Drake, and why was it created? And how does no dread work? In the next section, we learn about how to install no dread on different platforms.