Creating a custom node.js module with the Revealing Module pattern
So you want to utilize the revealing module pattern in a custom node.js module? It’s not hard but it wasn’t immediately obvious to me, so here’s how you do it.
exports variable. That
exports variable is what gets exposed to the class that requires your module.
For example, take a custom module mymodule.js:
Here’s how you’d use it: