Getting started with Node.js, section 2. In this section, we'll look at Node.js, what it is and why is it important for this course? First, let's look what Node.js is. Node is the letter N and the mean stack, even though it's the last letter doesn't mean is the least important. In fact, it's probably the most important ones. Node.js is an open- source JavaScript runtime environment. Notice it is the runtime environment, it's not a language nor an operating system or a server. It is just environment. It's built on Google Chrome's V8 JavaScript engine, the same engine that runs with the powers the Google Chrome web browser. It uses JavaScript as the main server-side language. Now that's pretty cool and it's a bonus for those of you who already know JavaScript. Because you have one language to master and you can use it to create web applications using just JavaScript. Because JavaScript is a single threaded language, so Node was built around that. That means it uses the single threaded model and we'll take a look at that and compare that to a traditional or multi threaded model and see what they look like. Also, the need thing about Node.js is this thing called the asynchronous environment with non-blocking execution of some code that will prevent your code from installing. This is something that is really nice in Node.js and last but not least, it has this built-in HTTP server library. Again, because Node is not as server, but it provides this Libraries so that you can create your own server, unlike Apache or the Windows iOS, which already built for you, you get to build your own here. Let's take a look at this two models here. The first is this multi threaded model or the traditional model. Let's take a look at this following an analogy, say that you are in this grocery store or a bank or a concert venue wherever it is and usually you have a bunch of people there, and then when you want to purchase tickets or check out or go to a teller, you would go to those lines. How many lines they have, that's your limit. You go to the teller in this example here and you can process your transaction for you if it's really easy one that's pretty quick, but sometimes you might need some more information. That's the case. Those tellers, might end up processing more information at the back, like they might need a manager's authorization or process some data and so on. When all these lines are filled up in all these tellers or cashiers are waiting, then the whole system comes to a halt. What do you do? You end up opening more lines, hiring more cashiers or tellers and so on. It becomes, what you call a CPU intensive system in the computer analogy here. This is the multi threaded model. Now let's take a look at is single threaded model. Same group of people here, for example. But instead of having a lot of people doing the processing, you just have one person that does the handling of this information here. A bank and a bank or is store doesn't matter, one teller, one cashier. In a process, each customer's probation. If the information or the request is very simple, it processes right away, and it's done. If any of those transactions require some really intensive information, then that would be delegated to a group of people in the back and they can process those data while the customers are waiting. The teller or the cashier can process the next request. Then at the back, they can process those information independently and the back end until that's done they come back to the cashier or the teller and then teller will provide the information back to the clients. In this case, you don't have anything that would cause the line to stop because as one customer is waiting, the next customer can be served. So you pump all these request response really quickly in the front. Now that's the single threaded model that Node.js uses. Let's take another model here, that is a little bit closer to the Node.js, Event loop. Here again, the red circle is the event loop. It's a single threaded non-blocking model. One that process all those information. On the front end we have a user or client, and we have some services in the back like databases and file systems and networks and so on. When a request comes to the event loop, it will look at that request and see what kind of request it is. If it's a real simple one, it sends right back. If it's something that requires a long running operations like a database query or file system, they will pass that to the back to be processed. In the back you have what's called a thread pool that will process all these long-running operations. Then while that's happening in the back, you have more request coming in. Again, any long running operations can be passed to the back. So will be all processing in the back until all those are returned. All these callbacks return, then that can be a process and then send it back to the user. This is the typical Node.js model that uses single threaded non-blocking feature here. I'll be referring to this model for the benefit throughout this course. Make sure you have a pretty good grasp of what this model looks like. Now that we know what Node.js is and what it's model looks like, in the next video, we'll install the latest version of node.js.