Singleton pattern for NodeJS modules
Luis Delgado

You don’t need all of that to get a singleton in node. If an object is instantiated in a module, and it is also exported, it’s already a singleton.

This is because node will cache all exported objects and reuse them the next time another file requires the module.

Like what you read? Give Carson Evans a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.