In this project, you can find 2 examples of the singleton pattern. Example 1 is pretty simple, it helps you to understand the basics of this pattern. However example 2 is more like a real-life usage of the singleton pattern.
Read more on Medium
npm i
npm run start:simple
You can find the entry point at src/simple.ts
and the rest of the necessary files under src/simple
npm start
You can find the entry point at src/main.ts
. The other necessary files are in the rest of the directories, but src/simple
.