ExpDev07 / coronavirus-tracker-api

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
https://coronavirus-tracker-api.herokuapp.com
GNU General Public License v3.0
1.59k stars 323 forks source link

Applying Singleton Pattern #437

Closed Dinosaur09 closed 3 years ago

Dinosaur09 commented 3 years ago

Course School Project

Singleton ensures that the class has one instance so I applied it in v2.py so it is not overwritten by other code. The getInstance() will check if any there exists any instances; it will return it if it does, if not, it will instantiate a new instance and then return that instance.