/cg_technical_challenge_frontend

Credit Group Technical Challenge - Frontend

Primary LanguageTypeScript

Credit Group Technical Challenge - Frontend

See Backend repo at https://github.com/luks04/cg_technical_challenge_backend.git

React app

It contains a React app which resolve the following objective:

Bulid a web service which exposes the current exchange rate of USD to MXN from three different sources in the same endpoint. The response format should be something like the following:

"rates": {
    "provider_1": {
        "last_updated": "2018-04-22T18:25:43.511Z",
        "value": 20.4722
    },
    "provider_2_variant_1": {
        "last_updated": "2018-04-23T18:25:43.511Z",
        "value": 20.5281
    }
}

Exchange rate sources:

Extra requirements:

  • API should be accessed with an Application Token.
  • API should have a rate limit per user.

Local Deployment

  1. Clone the repo and checkout to the desired branch:
git clone https://github.com/luks04/cg_technical_challenge_frontend
cd cg_technical_challenge_frontend
git checkout <branch_name>
  1. Change directory to React app folder and install node_modules:
cd root-app
npm install
  1. Run at localhost:3000:
npm start

Docker Deployment in Heroku

Heroku CLI needed. The Flask app is containerized using Docker, so to deploy the app in a production environment it is recommended to use Gunicorn (see src/Dockerfile).

  1. Clone the repo, checkout to the "develop" branch and login into Heroku CLI:
git clone https://github.com/luks04/cg_technical_challenge_backend.git
cd cg_technical_challenge_backend
git checkout develop
heroku login
  1. Delete Heroku remote old repository:
git remote rm heroku
  1. Check remote repositories:
git remote -v
  1. Deploy the app with a Dockerfile using heroku.yml:
heroku create <app_name>
heroku stack:set container
git push heroku <source_branch>:main
  1. Deploy new changes:
git add .
git commit -m "<commit message>"
git push heroku <source_branch>:main
  1. To show the logs use the next command:
heroku logs --tail