Chapter 1 provided a first look at a Node application with the traditional (and always entertaining) Hello, World application. The examples in the chapter made use of a couple of modules from what is known as the Node core: the API providing much of the functionality necessary for building Node applications.
In this chapter, I’m going to provide more detail on the Node core system. It’s not an exhaustive overview, since the API is quite large and dynamic in nature. Instead, we’ll focus on key elements of the API, and take a closer look at those that we’ll use in later chapters and/or are complex enough to need a more in-depth review.
Topics covered in this chapter include:
Node global objects, such as
The timer methods, such as
A quick overview of socket and stream modules and functionality
especially the part it plays in Node inheritance
EventEmitter object and
Node.js documentation for the current stable release is available at http://nodejs.org/api/.
There are several objects available to all Node applications without the user having to incorporate any module. The Node.js website groups these items under the descriptive label of globals.
We’ve been using one global,
require, to include modules into our
applications. We’ve also made extensive use of another global,
console, to log messages to the console. Other globals are essential to the underlying implementation ...