Learn Node.js, Unit 1: Overview of Node.js Learning Path
Get a high-level overview of our Node.js tutorial series
As a topic, Node is deep and wide. Choosing a finite number of topics to cover such a vast subject was a daunting task. It’s impossible to anticipate what every new Node developer will need, so I asked myself, “What would I have wanted to know before I started my Node journey?”
This Learning Path is the result. I hope you enjoy it.
Node is popular
As a platform, Node.js is one of the most popular server platforms in existence, and is the anchor of the MEAN stack. That means, if you know Node, your job prospects are good.
Node is powerful
Node also has a secret weapon in the battle for scalability: the event loop. Using asynchronous programming techniques, combined with the event loop, which processes I/O requests in separate threads in the background, Node can achieve ludicrous mode scalability (yes, that’s a thing).
Node is a community
The Node.js community is engaged, active, and open. Code sharing is the norm in the Node community through the npm registry, where you can find lots of code to use in your applications, complete with documentation and source code.
Want to get involved? There are dozens of ways you can contribute to the already extensive body of work in the Node community.
Structure of this learning path
The learning path is broken up into two main parts:
Part One: Learn Node.js – Units 2-9
- Install software – Unit 2
- The Node.js programming model – Units 3-6
- npm and packages – Units 7-8
- Testing – Unit 9
Part Two: Apply what you’ve learned: Node.js in Practice – Units 10-14
Source code for the learning path
The Node.Js Learning Path has a GitHub repo that contains every example from every unit, so you can run the examples yourself and follow along with the material.
In addition, most units in Part 1 have quizzes with programming exercises. The solutions for every programming exercise are included in the GitHub repo in case you get stuck.
If you have no programming experience at all, you will probably struggle through this Learning Path. Fortunately, there are lots of other great resources at IBM Developer to get you ready to take this learning path.
You need to be able to install software on your computer. You should also be familiar with using the command line on your particular platform. If you’re on MacOS (like I am), that means a Terminal window. On Windows, it’s the command prompt, and on Linux, the command line.
Now let’s talk about the Learning Path itself.
Part One: Learn Node
You’ll learn how to use Node.js. You’ll install the software you need to complete the Learning Path, and then learn the theory of Node.js, how to write Node application code, and how to write tests.
Below is a quick summary of each unit.
Unit 2: Install Node.js and npm software
This tutorial shows you how to install the
node program itself, along with
npm for managing Node projects.
In this tutorial, I show you three ways to get the Node software on your computer. Node’s active developer community means it is constantly evolving. For example, in the 10 weeks it took to write this Learning Path, Node went through five minor revisions (from 10.4.1 to 10.9.0 as I write this).
You must balance how easily you want to install Node with how difficult it will be to upgrade later. As such, I present the installation options in the order of how easy they are to install, which happens to be the opposite of how easy they are to upgrade. I give you the information you need to decide for yourself which option works for you.
- Download from nodejs.org – download the installation package for your platform and install it on your computer.
- Homebrew (MacOS only) – download and install Homebrew, then install Node using
brew install node
- Node Version Manager (nvm) – download and install nvm, then install Node using ‘nvm install` to install the version of Node you want
Be sure to watch the video, where I guide you through each type of install.
After completing Unit 2, you’ll be ready to write Node programs.
Unit 3: A tour of Node.js
To that end, in the third tutorial, I give you a light overview of all of Node’s “moving parts”:
- The Node runtime, which includes:
- The event loop: implemented using an event-driven, non-blocking I/O library called libuv to make it lightweight and efficient (and scalable)
- The Read-Eval-Print Loop (REPL)
- Non-blocking I/O model
- The npm ecosystem
It’s not all theory, though. You’ll write code that runs in the REPL and demonstrates Node’s non-blocking I/O model.
There’s a video, so you can see the REPL in action, and there’s even a quiz where you can test your understanding of the material in the unit.
The better you understand the Node architecture and non-blocking I/O model, the better Node programmer you will be. After completing this Node tutorial, you’ll have a basic understanding of how Node works under the hood, and how all the moving parts work together to make a Node application work.
Unit 4: Node.js concepts
Unit 4 takes you deeper into the Node.js concept, where you learn more about the Node non-blocking I/O model and asynchronous programming style by comparing and contrasting two different types of businesses: the bank and the coffee shop. It’s important to cement these concepts in your mind if you are to be an effective Node programmer.
Then, you examine Node’s module system: how to use and create modules, how to work with modules, and when to use them for both synchronous and asynchronous programming styles.
I show you how to use the Chrome V8 profiler to look for performance hot spots in your code, where you’ll profile synchronous and asynchronous programming examples that illustrate the power of Node’s non-blocking I/O model and the asynchronous programming style in general.
Unit 4 ends with an overview of promises, which you will use extensively throughout the Learning Path.
After completing this tutorial, you’ll have a good grasp of non-blocking I/O, asynchronous programming, the Chrome V8 engine, and load testing.
Be sure to check out the video that accompanies the unit, where I show you how Node modules work, examples of non-blocking I/O, and how to perform load testing on a Node application. There is also a quiz to test your understanding, along with programming exercises so you can write code.
Unit 5: The Node event loop
The key to Node’s scalability is the event loop, which supports its non-blocking I/O model.
Building on concepts from previous units, you learn more about what the event loop is, why it’s used, and how to map out the event loop’s phases using callbacks for timers, I/O, process.nextTick() and Promises. Other topics I cover include:
- Node events and how to create a custom event
- Streams and how to use them to map out the event loop’s phase
- How to pass arguments to timer callbacks
After completing this tutorial, you’ll have a thorough grasp of Node internals in general, and the event loop in particular.
I’ve included a video to accompany Unit 5 to help illustrate the concepts presented in the unit. There is also a quiz to help you gauge your progress, along with programming exercises so you can write code, too!
Unit 6: Your first Node.js application
In Unit 6, you participate on a mock Node project team where you finish writing the core of an application that lets a user create a shopping list. This unit introduces you to how you would work with Node as a developer on a real project.
Don’t worry, you won’t have to write the entire application from scratch. In this particular scenario, you step into a partially created project and complete the project.
As part of the scenario, you complete a set of REST services to support a Shopping List application that your company has sold to a customer. As you progress through the learning path, you evolve the Shopping List application, and learn about functional testing, how to load the data into a database, and how to debug your code in the VSCode debugger.
Unit 6 concludes with a video where I show you how to set up the project. I also give you a tour of the code, and show you how to run the functional tests, which determine when the application is working according to the specifications. If the functional tests pass, then your code works!
There is also a quiz to test your understanding, and you finish the application as an exercise (don’t worry, I’ve provided the solution if you get stuck).
After completing this tutorial, you will have written your first Node.js application and will be ready to move deeper into Node programming.
Unit 7: Node package manager (npm)
Package management is an integral part of Node programming, so it warrants its own unit. More than just a package manager program (
npm), npm is documentation, packages, and an entire ecosystem. In Unit 7, I show you all of this, and more.
Be sure to take the quiz to test your understanding.
After completing this tutorial, you’ll have a good grasp of npm.
Unit 8: Node dependency management
In Unit 8, you learn how to manage your dependencies.
At the heart of Node dependency management is
package.json, which is a manifest for your Node project. It includes:
- Project metadata like name, version, and so forth
- Dependency information in SemVer (Semantic Versioning) format
- Lots more
I show you how to create a new Node project, where the
npm tool creates a skeleton
project.json for you.
You also learn about Semantic Versioning (SemVer), why it’s so important to Node dependency management, and why you really need to understand it to specify your dependencies so they are properly managed by
Unit 8 includes a video where I show you the required elements of a
package.json file and the role of semver in dependency management. There’s also a quiz so you can test your understanding of the concepts from Unit 8.
After completing this tutorial, you’ll have a thorough understanding of Node dependency management, and the role of
package.json in your Node projects.
Unit 9: Testing
Testing is a fundamental part of software development. In Unit 9, I show you several tools that will help you test your Node applications to catch any bugs:
Using these three tools together will help you build awesome, error-free software.
You also learn how to run a tool called a linter on your code, which analyzes it for possible errors, and ensures that your code follows consistent, industry-standard coding style.
Unit 9 includes a video and a quiz.
After completing this tutorial, you’ll be ready to apply the Node knowledge that you gained from the first 9 units of this Learning Path.
Part Two: Apply what you’ve learned
Part two is where you’ll put into practice what you’ve learned, and tackle some issues you’re certain to see as a professional Node developer.
Below is a quick summary of each unit in Part Two.
Unit 10: Logging
Application logging is an area that needs a clear strategy.
console.log() is fine for amateurs, but professional Node developers use logging packages.
In Unit 10. learn how to use two very popular logging packages for Node applications:
I picked these two because you’re likely to run across them as a professional Node.js developer. There are others, sure, but let’s focus on these two, and you can build on that experience.
There is also a video to accompany the unit, where you can see both loggers in action.
Unit 11: ExpressJS
ExpressJS is a minimalistic, high performance, open source web framework, and is probably the most popular web framework used for Node.js applications. As a testament to its performance and popularity, Express is also the backbone for other popular frameworks like LoopBack.
In Unit 11, you work with the Express web frontend I put on the Shopping List application’s REST services from Unit 6. You learn all about Express middleware, routing, and view template processing using Pug (formerly Jade).
While working with Express middleware, you learn techniques for doing data validation and sanitization using
There is also a video to accompany the unit, where you can see the Shopping List UI in action.
Unit 12: MongoDB
MongoDB is one of the most popular NoSQL databases on the planet, so you will most likely run across it as a professional Node developer (or one like it).
In this tutorial, you work with the Shopping List application again, only this time the system of record is MongoDB. I give you an overview of MongoDB, show you how to install it for MacOS, Windows, and Linux, and show you how the Data Access Components of the Shopping List application use MongoDB.
As a bonus, I also introduce you to Mongoose, an extremely popular object data mapping (ODM) utility for MongoDB. Be sure to take a look at the Mongoose source files that are part of the unit’s source. As an exercise, you can play around with them, and plug Mongoose into the Shopping List application if you’re feeling up to the challenge.
Unit 12 also has a video where I show you an overview of MongoDB, introduce you to some MongoDB terminology, and show you some of the MongoDB API in action.
Unit 13: Debugging and profiling
Sometimes code we write has bugs that are just plain tough to track down, which is where source-level debugging comes in handy.
Other times, the code is functionally perfect, but just doesn’t perform (or scale) well, which is where a profiler comes in handy.
The ability to perform source-level debugging and profiling is a great skill to have for any developer.
In Unit 13, I show you how to use the VSCode source-level debugger to walk through your code line by line. Learn how to inspect variables, set up watch expressions, and even how to debug Mocha tests.
Profiling is a must-have skill for a Node developer. Why? Asynchronous programming is hard. Sometimes this results in hot spots (that is, performance bottlenecks) in the code that are difficult (if not impossible) to spot just by looking at the code. You have to run a profiler.
There is also a video where I show you how to set up VSCode to do source-level debugging, and how to use clinic doctor and bubble profiler to find performance bottlenecks.
Unit 14: Cloudant
Cloudant is a high-performance, high-availability, document-centric NoSQL database-as-a-service (DBaaS) offering available in the IBM Cloud.
NoSQL databases are extremely popular with the types of applications that work well with Node’s non-blocking I/O model, and asynchronous programming model, such as microservices.
Most enterprises are moving to the cloud because hosting your own servers is expensive and leaves you open to availability issues. With cloud computing, you pay for the cloud services you need, so you’re not stuck with expensive hardware you can’t afford. As more companies move to the cloud, you need to make sure you know how to create applications that scale on the cloud.
Unit 14 is about moving the data for the Shopping List application into the IBM Cloud. You learn how to set up your own Cloudant service, and will be able to play around with the finished complete, working application code.
There is also a video that shows you how to set up your Cloudant service, familiarizes you with the Cloudant dashboard, and shows you how to work with the database directly through the dashboard.
Hopefully you have a good understanding of what this learning path covers and are excited to get started.
In this video, I walk you through the Learning Path, explaining what you’ll learn along the way.