This repository contains the code of a NodeJS API to convert currencies.
Receives a GET request at /api/convert/{currency}/{amount}
and returns a JSON with the currency converted in the following format:
{
"USD": 98.23,
"EUR": 83.26,
"INR": 7318.93
}
- NodeJS
- Redis
- PostgreSQL
- Jest
- TypeORM
- Swagger
- Copy .env.example file to a new .env file and change any environment variable if needed;
- Start docker with
docker-compose up
ordocker-compose up -d
and this will install all project dependencies; - Run migrations with this command:
docker-compose run currency-conversion-api-development sh -c "yarn migration:run"
- Run tests with:
docker-compose -f docker-compose.test.yml --env-file .env.test run currency-conversion-api-test
- Tests can be run with postgres database or an in memory database, you just have to change the REPOSITORY_TYPE in the .env.test file;
Swagger documentation for the API can be found at localhost:3000/docs
.