Summary
We have seen in this chapter how to create and use modules with Node.js, which are the essential components of programs created with Node.js.
Whether the module is created by us, is an internal Node.js module, or is a module downloaded with npm
, its use is the same in all cases. We use the require(moduleName)
instruction and with the value returned in a variable, we access the functionality of the module.
Next, we are going to study the Express module, which is one of the main modules used with Node.js, allowing us to easily structure our applications according to the rules of the MVC model, currently widely used.