In this lesson, we introduce the process object, part of the node.js global namespace. The process object is extremely useful for identifying information about the runtime environment of your node app such as the version of node, the arguments passed to the node executable, the current working directory, and the nextTick function. All of these are discussed and illustrated with examples in this lesson.
In this lesson, we introduce modules: what they are and how to use them. You'll learn:
how to create a simple module and export the functions to be accessed elsewhere
how to include code from your module in files within your application
the three rules node uses to find the modules you require
the hierarchy node uses to determine which modules take precedence
which file extensions node can automatically detect when requiring modules
In this lesson, you will learn the difference between the exports statement and module.exports. Two examples are demonstrated, each accomplishing the same task but one using export statements and one using module.exports. You will also learn the basic thumb rule to identify which is appropriate for your current needs.
In this lesson, you will learn how to find packages to add functionality to your application. You will also learn some valuable tips on how to choose a stable, supported package. We also demonstrate how to install packages using npm and the two simple rules to understand when you should install globally with the -g flag or install the package locally. The dependency section of package.json is used to show how to manage dependencies for both production and development packages. Finally, the caret (^), tilde(~), and star (*) wildcards are explained to control which versions your package is compatible with as well as installing package dependencies from git repos.
In this lesson, you'll learn how to include the built-in node.js 'net' module in your application and create a TCP server. You will learn about the different event listeners used, how to specify specific ports and addresses for your server, and identify where each section of your code is used in the server lifecycle.
You would use the TCP module in scenarios where you want to deal with the raw TCP data yourself- for instance, creating your own messaging platform over TCP.
Sharing code and extending functionality in node.js is often done with modules. In this lesson, you will learn how to use npm init to scaffold a new module, verify proper installation, and identify the components needed to publish your module to public and private registries.
This lesson shows you how to:
* create a user account on the npm registry
* publish your module to the registry
* use npm version to bump the version number of your package
* publish updated versions of your module to the registry
* unpublish modules from the registry
In this lesson, you will learn what an EventEmitter is and how it works. We start with a simple example creating an instance of the EventEmitter class, then expand on it by building listeners and emitting events to trigger them. You will learn how to view listeners in the global emitter object, as well as how to remove them and understand what the EventEmitter memory leak message means. We wrap everything up by examining the http server class to illustrate how node.js uses EventEmitters in many places for core features.
In this lesson, you will learn how to use view and interpret the garbage collection activity of your node.js app via the console. You will also learn how to take heapdump snapshots and analyze them with Chrome Developer Tools to identify possible memory leaks. A sample app with a known memory leak is provided as part of the walk-through to illustrate how to use the tools in your own environments.