How (not) to create a singleton in Node.js
This morning a colleague asked me a question about exporting a module in Node.js and how to export a singleton and I had trouble coming up with an answer that covered the different ways you can create a module in Node.js, and we know what that means.
If you can’t explain it simply,
you don’t understand it well enough.
From looking at Stack Overflow which referenced the Node.js documentation it rapidly became apparent the real question…