Skip to content

Conversation

@bjy19
Copy link

@bjy19 bjy19 commented Aug 11, 2021

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 the main.py file. And the use of this instance is the second router v2.py for getting data from the source.

@Kilo59 Kilo59 closed this Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants