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 320 forks source link

Creational pattern #469

Closed Vimarsh-98 closed 3 years ago

Vimarsh-98 commented 3 years ago

I applied a singleton pattern. The reason I chose singleton is because location/init.py makes use of both utils/countries.py and utils/population.py. I combined the two in one class and created a single instance and this instance is shared to all clients. How I did it: I added a singleton pattern in utils/countries_population.py