This course has been updated! We now recommend you take the Introduction to Node.js, v2 course.
Table of Contents
Course OverviewScott Moss introduces himself, the course repository, and sets the agenda for the day of starting with Node.js basics, then introducing topics until a server is deployed.
Creating with Node.jsScott gives an overview of use cases when creating apps with Nodejs.
Installing Node.jsScott describes installing node using both from Nodejs source, and using NVM. Scott explains several costs and benefits of each, and why NVM is the preferred method.
Installing Node.js from the sourceScott demonstrates how to download Nodejs without the aid of NVM.
Installing Node.js with NVMScott gives instruction on the recommended way to download Node js using nvm.
Install and Run Node.js ExerciseScott introduces the first exercise: getting Node.js installed!
Checking Install & Running Node.js SolutionScott troubleshoots some common issues with Node.js installation, and demonstrates how to execute a file.
Globals in Node.jsScott gives an overview of process, require, __dirname, module, and global, that are all global variables provided to apps by Node.js.
Node.js ModulesScott introduces what Node modules are, and recommends ESM as it is the newest standard. This course will be using CommonJS.
Creating Node ModulesScott demonstrates a pattern for Commonjs exports while explaining the difference between default and named exports, coaches on the importance of explicit exports, and advises against using the exports global.
Importing Node ModulesScott demonstrates how to use the require keyword to import node modules. It's specifically detailed how to require modules that are user-created.
Internal Modules & npm
The fs ModuleScott walks through several examples of how to read and write to files using the fs Module that is shipped with Node js.
Other Internal Node ModulesScott briefly speaks to the http module, then moves on to talk about the path module that normalizes paths for the user, and mentions the url and crypto modules.
Remote ModulesScott introduces modules created by other people on the internet, and why it's more efficient to utilize these than writing them from scratch. The community of Node js, public modules, and malicious modules are all discussed.
Modules RecapScott gives an overview of how to require custom local modules, remote modules, and shipped modules. Attention is given to why it's important to note if the remote module has the same name as a shipped module.
npmScott gives an overview about how to select reputable modules, what dependencies and devDependencies are in a package.json file, how to install a single node module, and most common use cases.
yarnScott introduces another package manager created by a different company that does similar things to npm.
CLI with Node ExerciseStudents are instructed to complete a program that saves and retrieves contacts from an address book.
CLI with Node SolutionScott live codes the solution to the exercise, instructs on how to add formatting to the output JSON, and discusses using path.resolve() versus path.join().
commander Module for Building CLIsScott shows the "hack" around the process module called commander that was used to create commands, have aliases, and have a full CLI.
Asynchronous PatternsScott gives examples of callbacks, promises, and async/await
Error HandlingScott explains why it's imperative to handle errors in Node js.
ServersScott introduces how servers interact with the Node js environment.
Asynchronous Server ExerciseStudents are instructed to refactor and fix a simple static asset server.
Asynchronous Server SolutionScott live-codes the solution to the exercise, and gets feedback from students on how they solved the exercise, and difficulties they had.
Debugging & Testing
Debugging NodeScott explains the three paths to debugging, including using logs, using the node inspector, and utilizing text editor integration.
Testing Node LibrariesScott details how Node js has advanced to be extremely versatile over the last few iterations, and gives several use cases for testing in Node js.
Anatomy of TestsScott gives a brief description of test suites, assertion libraries, mocks, and spies.
Types of TestsScott defines what unit, integration, E2E, UI, snapshot, and performance testing are.
Debugging & Testing ExerciseStudents are directed to find and debug several issues in the app, and then implement unit tests to ensure that they stay fixed.
Debugging & Testing SolutionScott live codes the solution to the exercise using Chrome inspector, and fields a question from the audience afterwards about how to autopopulate the chrome inspector with the files. How to write the tests to test for the bugs that were caught is also briefly covered.
Publishing and Deploying
Sharing ModulesScott details the checklist to go through to make modules sharing-ready.
Deploying Your ServersScott details what to think about when deploying the server to a cloud provider. Questions are also answered about versions, and the difference between a static site generator and static site server.
Deploying to HerokuScott demonstrates how to deploy the module to Heroku, and describes how to publish to npm.
Further Tools & ResourcesScott gives an overview of how to take this knowledge and bring it further than this course.
Final Q&AA question is asked about CMS, and Scott wraps up the course by giving further resources and thoughts.