mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-21 18:42:29 +01:00
cfbb4ac4ac
I'm moving my company's server to a private location now that I have sold the domain. While prepping for this, I've done some cleanup and also threw in changes I had lingering on my hard drive. - Run a single database query instead of two - Fold the gem into the app and use Ox instead of REXML - Simplify error handling logic - Relax throttling |
||
---|---|---|
bin | ||
config | ||
db/migrate | ||
lib | ||
public | ||
spec | ||
.dockerignore | ||
.env.example | ||
.gitignore | ||
.rubocop.yml | ||
.tool-versions | ||
.travis.yml | ||
config.ru | ||
docker-compose.override.yml | ||
docker-compose.prod.yml | ||
docker-compose.yml | ||
Dockerfile | ||
Gemfile | ||
Gemfile.lock | ||
LICENSE | ||
limit_req.conf | ||
Rakefile | ||
README.md |
Fixer
Fixer is a free API for current and historical foreign exchange rates published by the European Central Bank.
Rates are updated around 4PM CET every working day.
Usage
Get the latest foreign exchange rates.
GET /latest
Get historical rates for any day since 1999.
GET /2000-01-03
Rates quote against the Euro by default. Quote against a different currency.
GET /latest?from=USD
Request specific exchange rates.
GET /latest?to=GBP
Change the amount requested.
GET /latest?amount=100
The primary use case is client side. For instance, with money.js in the browser
let demo = () => {
let rate = fx(1).from("GBP").to("USD")
alert("£1 = $" + rate.toFixed(4))
}
fetch('https://api.example.com/latest')
.then((resp) => resp.json())
.then((data) => fx.rates = data.rates)
.then(demo)
Installation
To build locally, type
docker-compose up -d
Now you can access the API at
http://localhost:8080
In production, create a .env
file and run with
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d