-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback mechanism #90
Comments
Whats the difference between |
|
brother please help.. i am new to programing. just making currency converter. |
@gaganpreetsharma000, have you seen the migration instruction? It's pretty clear. By the url, https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/inr.json you are fetching data in the rate INR/XXX, where XXX is another currecy from the got JSON, e.g. USD. In that case, one INR costs 0.012070684 USD. As you need usd/inr, you have to fetch data USD/XXX: https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json, where you'll get a cost of one USD in different currencies, and select the needed one from the received JSON, in your case INR. Try async function getUsdInrRate() {
// This url will give you currencies UDS/XXX
const url = 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.min.json'
// Fetch data and get INR rate
const inr = await fetch(url)
.then(response => response.json())
.then(data => data['usd'].inr)
console.log(inr)
}
getUsdInrRate() You'll get current rate Tip Use min versions of the files to get reduced files (whitespaces deleted), and faster responses, I assume. |
i face the same issue do you have its solution ??? |
Fallback URL:
Pseudo code:
For example, if you want to fetch
eur
:The text was updated successfully, but these errors were encountered: