Currency Converter API.
API to convert currencies using different exchange rates. Exchange rates are updated automatically every 30 minutes.
The project was created using the following technologies:
- Docker
- docker-compose
- Node
- MongoDB
- Redis
Using Docker and docker-compose
Install the npm packages:
docker compose run --rm api npm install
Run the script to create suppported currencies:
docker compose run --rm api npm run seed
Run the script that loads the initial exchange rates:
docker compose run --rm api npm run load:rates
Starting the project:
docker compose up api
http://0.0.0.0:5000/api-docs/
Inserting a new currency:
POST 0.0.0.0:5000/currencies
BODY
{
"symbol": "PHP",
"label": "Philippine Peso"
}
Getting a currency:
GET 0.0.0.0:5000/currencies/PHP
{
"_id": "600905bd9640e7037b38209c",
"label": "Phillipines Test",
"__v": 0
}
Removing a currency:
DELETE 0.0.0.0:5000/currencies/PHP
Converting currencies between different exchange rates:
GET 0.0.0.0:5000/exchanges/convert?from=USD&to=BRL&amount=123.45
{
"amount": "667.8645"
}
docker compose run --rm api npm run test
In this repository, there is a git submodule (frontend) which is a React project. In it, I demonstrate the use of the Currency Converter API in a web project.
The project has the Currency Converter API as a dependency, so when you run it, the API must be configured.
Initialize the submodule:
git submodule init
Forces the git to clone the submodule:
git submodule update
Initialize the frontend app and the backend (API) as dependency:
docker compose up app