Table of Contents
IntroductionScott Moss introduces the course by providing some personal and professional background. An overview of the material that will be covered and course resources are also provided in this segment.
Non-Blocking I/OScott explains the non-blocking I/O model employed by Node.js to handle concurrent connections in high-performance network applications. Key features, such as event loops, callbacks, non-blocking APIs, and its single-threaded nature, contribute to its efficiency.
Hello WorldScott walks through the setup of Node.js and a version manager called nvm. The segment includes creating a simple Node.js program that prints to the terminal.
Creating a CLI
Process & EnvironmentScott explains the global process object, highlighting commonly used properties and methods attached to it. The segment also covers using process.env to access environment variables.
Custom CLI SetupScott explains command-line interfaces, demonstrates creating a Node.js project using npm, and covers the contents of the generated package.json file. The segment also includes linking to the file and defining the script's environment with a hashbang.
Processing CLI ArgumentsScott walks through the process of building out the logic for a custom note-taking CLI, enabling it to accept input from the terminal as a new note.
Modules OverviewScott discusses Node.js modules, which are self-contained pieces of code designed to perform specific tasks. Node.js has three types of modules: internal, user-created, and third-party modules.
Importing & Exporting ModulesScott demonstrates how to import both internal and external modules in Node.js. The differences between using `require` and `import` for including external modules are also explained in this segment.
Thinking in ModulesScott discusses things to keep in mind when developing modules for Node.js apps. This segment covers topics such as module contents, export and import patterns, and index.js patterns.
Internal & 3rd-Party ModulesScott discusses built-in modules that are available within the Node.js environment. Installing, updating, and removing third-party modules using npm is also covered in this segment.
Using the yargs ModuleScott demonstrates the installation and usage of the third-party yargs module to implement a help command for the custom note-taking CLI.
Notes App CommandsScott sets up the foundation for CLI commands such as new, all, find, remove, web, and clean.
Async CodeScott explains the benefits of asynchronous code, which allows other operations to occur while waiting for a task to complete. A demonstration of how to avoid nested callbacks using promises is also covered in this segment.
FS ModuleScott demonstrates how to use the built-in FS module, which provides an API for interacting with the file system. Student questions regarding debugging errors involving nesting callbacks are also covered in this segment.
CRUD Methods: CreateScott explains CRUD operations, which involve create, read, update, and delete actions on the notes in the database. Abstracting the previously created insert utility function for creating new notes and a student's question about destructuring are also covered in this segment.
CRUD Methods: Read & DeleteScott develops a function to fetch all notes from the database and filters them based on the provided filter string. A demonstration of the process of removing notes with specific IDs and clearing all notes from the database in this segment is also provided in this segment.
Using the CRUD MethodsScott updates the commands to utilize the previously created CRUD methods, allowing for better functionality and interaction with the notes in the database.
Types of TestsScott discusses the different types of testing in a Node.js application, which include unit testing, integration testing, end-to-end testing, and API testing.
Unit Testing with JestScott demonstrates writing and running tests using the Jest testing framework. Jest automatically scans for test files in the tests directory and executes them.
Testing with MocksScott discusses testing with mock functions and data to perform tests without modifying the actual data in the database. Mock functions, also referred to as "spies," observe the behavior of indirectly called functions, allowing for thorough testing of function behavior and output.
Additional Test ExamplesScott demonstrates additional examples of tests for different functionalities and use cases.
Creating a Basic ServerScott discusses the concept of a Node.js server, which listens for incoming network requests and responds by executing code or providing data. A walk through the process of creating a basic Node.js server is also covered this segment.
Interpolating Data & Formatting NotesScott showcases how to interpolate the notes data, inserting or embedding values into a string or template to dynamically create a new string. How to define the format of the returned notes is also covered in this segment.
Sending Notes to the ClientScott illustrates the utilization of the createServer function to take the array of notes and generate a Node.js HTTP server that serves the formatted HTML to the client.