From 0e8e277124568d87d097806aa76af54557ce840c Mon Sep 17 00:00:00 2001 From: Fawaz Ahmed Date: Fri, 18 Oct 2024 08:18:13 +0530 Subject: [PATCH] Update MIGRATION.md --- MIGRATION.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 9080c3c..f9d512d 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,16 +1,15 @@ ### Migration Guide -1. Change the URL from `https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/{date}/{endpoint}`
to
`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@{date}/v1/{endpoint}` - -2. There is no `/currencies/{currencyCode}/{currencyCode}` endpoint in this new API, so please only use `/currencies/{currencyCode}` endpoint. For example: - -```js -json = fetchJSON(`/currencies/{fromCurrency}/{toCurrency}`) -rate = json[toCurrency] +1. Change the URL +```diff +- https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/{date}/{endpoint} ++ https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@{date}/v1/{endpoint} ``` -becomes -```js -json = fetchJSON(`/currencies/{fromCurrency}`) -rate = json[fromCurrency][toCurrency] +2. Change all `/currencies/{currencyCode}/{currencyCode}` endpoints to `/currencies/{currencyCode}` endpoint. +```diff +- json = fetchJSON(`/currencies/{fromCurrency}/{toCurrency}`) ++ json = fetchJSON(`/currencies/{fromCurrency}`) +- rate = json[toCurrency] ++ rate = json[fromCurrency][toCurrency] ``` 3. (Optional Step) Add [Fallback mechanism](https://github.com/fawazahmed0/exchange-api/blob/main/README.md#additional-fallback-url-on-cloudflare:~:text=Additional%20Fallback%20URL%20on%20Cloudflare%3A) in your code, to avoid any issue in the future.