Node.js Packages
Let's see how the Node platform provides a way to structure an application under the form of a package.
We'll cover the following...
Anatomy of a package
Technically, a package is a folder containing the following elements:
- A
package.json
file that describes the application and its dependencies. - A entry point into the application, defaulting to the
index.js
file. - A
node_modules/
subfolder, which is the default place where Node looks for modules to be loaded into the application. - All the other files forming the source code of the application.
The package.json
file
This JSON file describes the application and its dependencies, you can think of it as the app’s ID document. It has a well-defined format consisting of many fields, most of them ...