Chapter 5. Package Management

In Chapter 1, we briefly learned about Node’s default package manager, npm. It’s now time to take a deeper look and get comfortable finding, using, and creating packages for Node.

The term package is what the software world uses to describe a folder that contains code. In Node, that folder will also have a package.json file that describes the metadata and dependencies of the package.

The term module refers to a single file or a collection of related files that encapsulate a set of functionality. Modules allow developers to organize their code into separate and reusable units. A Node package often represents a single Node module, but some packages have more than one module.

A package usually refers to external code that a project depends on, but I think a better word to describe package code is generic. You can make pieces of your own code generic and extract them into a package that you can then ...

Get Efficient Node.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.