Open fawazahmed0 opened 8 months ago
thanks for the clarification, let's home NPM will be fine with it.
@fawazahmed0 I just wanted to say a big thank you for providing and maintaining this service 🙏
Great idea to add the cloudflare fallback URL.
@fawazahmed0 is there a way to download the data between 2022 and the migration? thanks
@fawazahmed0 You also can use ipfs
justice for /currencies/{currencyCode}/{currencyCode} Api user
Now how can I convert the currency?
justice for /currencies/{currencyCode}/{currencyCode} Api user
Old Currency API:
json = fetchJSON(`/currencies/{fromCurrency}/{toCurrency}`)
rate = json[toCurrency]
New Currency API:
json = fetchJSON(`/currencies/{fromCurrency}`)
rate = json[fromCurrency][toCurrency]
justice for /currencies/{currencyCode}/{currencyCode} Api user
how exactly can i use the new api
@Not-Secret-Dev with this new api we cannot convert currency anymore.
justice for /currencies/{currencyCode}/{currencyCode} Api user
how exactly can i use the new api
const baseURL = `https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies`;
const URL = `${baseURL}/${fromCurrency}.json`;
// Use it in async func. obviously
try {
let response = await fetch(URL);
let responseJSON = await response.json();
let rate = responseJSON[fromCurrency][toCurrency];
if (!response.ok) {
throw new Error(`Network response was not ok`);
}
} catch (error) {
msg.innerHTML = `Failed to fetch exchange rate. Try again later.`;
console.error("Fetch error:", error);
return;
}
I got email from GitHub to remove currency-api repository, due to large size. I have migrated things to cloudflare and npm. Please read the migration guide to migrate from old currency-api.