
The Hard Parts of Servers & Node.js
Learning Paths:
Table of Contents
Introduction
Introduction
Will Sentance introduces the course on Servers and Node.js by explaining why Node is such a powerful piece of technology.Node Overview
Will diagrams client-server interactions in a web application to highlight the area where Node operates.JavaScript, Node & The Computer
Will explains the role of JavaScript and Node within a server and differentiates between the two roles.Executing JavaScript Code Review
Will walks line by line through the execution of code in JavaScript to demonstrate what is going on under the hood.Executing Node Code
Will discusses how Node is able to talk with the inner features of the server computer to enable network communication.
Using Node APIs
Calling Node with JavaScript
Will explains what is occurring within the server when using Node to open a network channel that listens for incoming requests.Calling Methods in Node
Will explores the inner process of using Node's createServer method to auto-run a specified JavaScript function.Calling a Function Under the Hood
Will analyzes Node's role in running a function, including auto-running the function at the right time and inserting arguments.Creating a Server Under the Hood
Will discusses what occurs when HTTP messages arrive in Node and how Node sets up two JavaScript objects automatically, one for the received information and one to send back to the client.Creating a Server Summary
Will summarizes the timeline of events in JavaScript and Node from previous lessons and reviews each part of the system's role in creating a server.Node Under the Hood Q&A
Will fields questions about semicolon usage, port numbers, errors, the end function, and the timing of auto-running functions.Request & Response with Node
After summarizing the functionality created by the server creation code, Will gives a real-world example of how Node is being used in relation to server requests and responses.Express Q&A
Will discusses the goals of the course and then explains what the job of Express and other middleware is within Node.
Node with HTTP
Preparing for HTTPRequestObject
Will walks through the execution of JavaScript code that sets up the server to receive HTTP requests.Parsing HTTPRequestObject
Will demonstrates how the HTTP message arrives in Node and is then parsed to acquire needed information from the request message.HTTP Response in Node
Will runs through the process of filling in the auto-run function's parameters and executing it, and then using end to trigger Node to send the response.HTTP Request & Response Q&A
Will fields questions about data handling, where to declare get/post methods, errors during JavaScript execution, and the request method.Response Headers
Will discusses the headers for the response in HTTP format, and mentions a few additional items the response can include.Intro to Require in Node
Will explains the value of using the built-in require method to access certain features in Node.JavaScript Node Development
Will describes how to write code in JavaScript, load the code into Node, and then run the code. Nodemon is introduced as well.Cloud Node Development
Will explains how cloud development allows developers to run Node on external computers. Will also explains the role of devops professionals.Local Node Development
Will describes how to run JavaScript code and Node apps locally for the purposes of testing, using the localhost domain.Node Pair Programming Setup
Will gives instructions for running Node with JavaScript code locally and instructs students to complete the exercises using pair programing.
Events & Error Handling
Error Handling in Node
Will explains how Node's background HTTP features determine which function to auto-run, specifically for errors instead of requests.Event Handling in Node
Will discusses the event system in Node by going over how to edit a server after setup to respond to certain events differently or change ports.Modifying the Node Server
Will walks through lines of JavaScript code to modify the server by declaring functions to run on request and client error events.Node Event Handling in Action
Will demonstrates how the server reacts to a client error and how Node auto-runs the function that was specified to be run.
File System
Introducing the File System API
Will plans out a way to use the file system API, fs, to save the tweets into the file system and then apply modifications using JavaScript.Importing with fs
Will explains location in the terminal, the benefits of using json to store data, and then diagrams the process of storing and using json data.Reading from the File System with fs
Will highlights the process of using fs to read from the computer's file system to modify the data, explaining how JavaScript is used to trigger Node functionality. Threads are also discussed.Call Stack Introduction
While going through each line of execution for modifying the data acquired through fs.readFile, Will describes how JavaScript's call stack works along with what data is stored in local memory.File System Q&A
Will fields questions about the call stack, the buffer data format, imports, the auto-created error object, and parsing file contents.
Streams
Introducing Node Streams
Will introduces Node streams by presenting a use case where a group of data is broken up and worked on in parallel.Node Streams Overview
Will creates a diagram of a Node stream and explains how streams processes large-scale data in a more efficient method.Setting Up the Stream
Will walks through the execution of code that uses readStream to set up a stream to a JSON file and set a function for Node to auto-run on each batch of data.Processing Data in Batches
Will demonstrates how Node processes data in batches, which involves auto-running the specified function on a batch and adding calls for subsequent batches to a queue.Checking the Callback Queue
Will runs through Node's event loop process, where the callback queue is checked and a call to the auto-run function is made on each batch at the correct time.Node Streams Q&A
After discussing the callback queue and event loop, Will fields questions about sharing the queue, the final batch of data, buffers, queue timing, and handling incomplete data.
Asynchronicity in Node
Introduction to Asynchronicity
Will emphasises the importance of knowing in what order Node is executing queued operations and why, and sets up the section to examine how Node's event loop, stacks, and queues work.Timer Queue
Will introduces the timer queue by beginning to walk through code that demonstrates how the event loop prioritizes certain queues over others.IO Queue
Will introduces the IO queue by further explaining the event loop's prioritization system, diagramming the addition of calls to the timer and IO queues.Check Queue
Will introduces the check queue and demonstrates how setImmediate adds function calls to the check queue, as well as in what order queued elements will be run.Event Loop Completion
Will completes the event loop's processing of the various queues to demonstrate the order in which each queue is checked.Microtask & Close Queues
Will introduces the microtask and close queues, and explains when the items within will run compared to those in other queues.Priority of Queue Execution
Will summarizes Node's event loop's priority rules for automatic execution of JavaScript code within the queue system.Asynchronicity in Node Q&A
Will fields student questions about require, the structure of the code that makes up the event loop, and the queue data structure.