File and process management
We will start our overview of Node.js with the basics. This will include loading modules, managing processes, handling files and paths, and REPL (Read Eval Print Loop). These are things that virtually any Node.js project will need.
Modules
Node.js is a modular system. Much of the functionality of Node.js is contained in modules that must be loaded at runtime. This makes the knowledge of loading and building modules a core requirement to using Node. Here are the references you can use for your Node modules:
require()modules.export
require()
This loads the module at the given path:
require(path)
Return value
The return value will be an object. The properties of this object will vary, depending on what is loaded. We will cover module.exports next, which is what module designers and even you can use to set the value of this return value.
Description
The require() function is used to load the module at a path, where the path can be a core module (a module packaged with Node...