Skip to content

RaphaelBatagini/currency-converter-api

Repository files navigation

Currency Converter API

This repository contains the code of a NodeJS API to convert currencies.

Tests

How it works

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
}

Technologies 💻

  • NodeJS
  • Redis
  • PostgreSQL
  • Jest
  • TypeORM
  • Swagger

Setup ⚙️

  1. Copy .env.example file to a new .env file and change any environment variable if needed;
  2. Start docker with docker-compose up or docker-compose up -d and this will install all project dependencies;
  3. Run migrations with this command:
docker-compose run currency-conversion-api-development sh -c "yarn migration:run"

Running tests 🧪

  1. Run tests with:
docker-compose -f docker-compose.test.yml --env-file .env.test run currency-conversion-api-test
  1. 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;

Documentation 📚

Swagger documentation for the API can be found at localhost:3000/docs.

About

NodeJS API to convert currencies.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages