🦠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!
Why I used it.
In this API we have to decide first that from which source we are going to get all data. if we do not decide then it will give data from the default source. Here once you define the source then it will remain the same for all user endpoints. So it is better to use a singleton.
How I made it.
I have added a singleton pattern in the source at the data/__init__.pyfile. And I am creating a singleton instance inside the main.pyfile. And the use of this instance is the second router v2.py for getting data from the source.
Why I used it. In this API we have to decide first that from which source we are going to get all data. if we do not decide then it will give data from the default source. Here once you define the source then it will remain the same for all user endpoints. So it is better to use a singleton.
How I made it. I have added a singleton pattern in the source at the
data/__init__.py
file. And I am creating a singleton instance inside themain.py
file. And the use of this instance is the second routerv2.py
for getting data from the source.