Chapter 5. Wiring Modules
require() function (as we have seen in Chapter 1, Node.js Design Fundamentals), a simple yet powerful approach. However, many developers new to Node.js might find this confusing; one of the most asked questions is in fact: what's the best way to pass an instance of component X into module Y?
Sometimes, this confusion results in a desperate quest for the Singleton pattern in the hope of finding a more familiar way to link our modules together. On the other side, some might ...