Understanding callback execution in the event loop


show more Understanding callback execution in the event loop provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013) show less
please wait ...

Understanding callback execution in the event loop

When a Node program starts, the event loop starts along with it automatically. In this video, we'll take a look at how the event loop works, and why it's important for your programs. Let's go to the Exercise Files. Go to chapter 2, video 3. I'm going to Copy server.js to the desktop. And now I'm going to take a look at it, in sublime text. Now, in contrast to many other environments, all input and output in Node is non blocking. So for instance, if you're making a call to a database, in many other environments, that call is going to block.

The environment is going to wait for all those results to come back from the database, stop your program, and then resume your program once those results are ready. Node however, keeps running the program. In this file, we're requiring the http module. We're going to create an http server that's going to keep on serving requests, regardless of how many requests come in. Then on line 3, we're defining a function called handleReq...

Understanding callback execution in the event loop
Video duration: 3m 37s 3h 17m Intermediate

Viewers:

Understanding callback execution in the event loop provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013)

Subject:
Developer
Software:
JavaScript Node.js
Author:
please wait ...