0
0
mirror of https://github.com/fawazahmed0/exchange-api.git synced 2025-06-30 18:43:02 +00:00
exchange-api/MIGRATION.md
2024-03-07 00:05:53 +05:30

1.0 KiB

Migration Guide

  1. Change the URL from https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@{apiVersion}/{date}/{endpoint}
    to
    https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@{date}/{apiVersion}/{endpoint}

  2. There is no /currencies/{currencyCode}/{currencyCode} endpoint in this new API, so please only use /currencies/{currencyCode} endpoint. For example:

json = fetchJSON(`/currencies/{fromCurrency}/{toCurrency}`)
rate = json[toCurrency]

becomes

json = fetchJSON(`/currencies/{fromCurrency}`)
rate = json[fromCurrency][toCurrency]
  1. (Optional Step) Add Fallback mechanism in your code, to avoid any issue in the future.

Refer Readme for URL examples and refer this to know why migration was necessary