See Backend repo at https://github.com/luks04/cg_technical_challenge_backend.git
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:
- Diario Oficial de la Federación - No API provided, so you will need to scrape the site
- Fixer - Well documented API in JSON format
- Banxico - Service SF43718. API returns XML.
Extra requirements:
- API should be accessed with an Application Token.
- API should have a rate limit per user.
- 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>
- Change directory to React app folder and install node_modules:
cd root-app
npm install
- Run at localhost:3000:
npm start
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).
- 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
- Delete Heroku remote old repository:
git remote rm heroku
- Check remote repositories:
git remote -v
- Deploy the app with a Dockerfile using heroku.yml:
heroku create <app_name>
heroku stack:set container
git push heroku <source_branch>:main
- Deploy new changes:
git add .
git commit -m "<commit message>"
git push heroku <source_branch>:main
- To show the logs use the next command:
heroku logs --tail