fawazahmed0/hadith-api

Include fallback mechanism in your code to avoid issues

fawazahmed0 opened this issue · 0 comments

This API have multiple fallback urls:

Fallback URL:

https://raw.githubusercontent.com/fawazahmed0/hadith-api/{apiVersion}/{endpoint}

Pseudo code:
For example, if you want to fetch eng-muslim edition

Fetch https://cdn.jsdelivr.net/gh/fawazahmed0/hadith-api@1/editions/eng-muslim.min.json
If above url fails, then try fetching https://cdn.jsdelivr.net/gh/fawazahmed0/hadith-api@1/editions/eng-muslim.json
If above url fails, then try fetching https://raw.githubusercontent.com/fawazahmed0/hadith-api/1/editions/eng-muslim.min.json
If above url fails, then try fetching https://raw.githubusercontent.com/fawazahmed0/hadith-api/1/editions/eng-muslim.json