Giter Site home page Giter Site logo

Comments (3)

kwerty avatar kwerty commented on June 15, 2024

If the https://ratesapi.io/ and https://exchangerate.host/ APIs are able to provide the exact same API responses, perhaps @over-engineer might consider making a one line fix to switch to one of these?

from exchange-rates.

over-engineer avatar over-engineer commented on June 15, 2024

Hey @mickyjohnstonmonotype, thanks for bringing this to my attention! It's unfortunate that exchangeratesapi.io (afaict) changed without any prior notice.

Likely, this wrapper works with pretty much any Fixer.io-compatible API. That means, switching to ratesapi.io was a drop-in replacement, like @kwerty suggested.

I just pushed an update to npm, so it now uses ratesapi.io by default. 😄

You just have to update to the latest version (1.1.0) and everything will be back to normal. No breaking changes.


I've also added a new setApiBaseUrl() function, which allows you to use a different API (any Fixer.io-compatible API will probably work).

See Using a different API.

For example, you can switch to exchangerate.host like this:

const { exchangeRates } = require('exchange-rates-api');

(async () => {
    await exchangeRates()
        .setApiBaseUrl('https://api.exchangerate.host')
        .latest()
        .fetch();    // {THB: 34.978, PHP: 58.159, …, HUF: 323.58}
})();

from exchange-rates.

kwerty avatar kwerty commented on June 15, 2024

The alternative API is now blocking CORS also.

Good thinking ahead @over-engineer ! Switched to another API with ease

await exchangeRates().setApiBaseUrl('https://api.exchangerate.host').

from exchange-rates.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.