Skip to content

almeigab/challenge-bravo

 
 

Repository files navigation

Hurb Bravo Challenge

JavaScript NodeJS Express.js Docker MongoDB Jest ESLint Swagger GitHub Actions

A Rest API for Currency Conversion.

Contents

Description

This API lets you make conversions between different currencies.

The initial currencies that are already registered are USD, BRL, EUR, BTC and ETH.

You are also able to register any currency (FIAT, crypto or fictitious - exchange rate for fictitious currency must be provided). You can also list all registered currencies and delete any.

⚠️ This app retrieves currencies rates every hour from Free Currency Rates API.

Technologies

This project is currently using:

  • NodeJS 16.14.2
  • npm 8.6.0
  • Express 4.18.8
  • Docker 20.10.14
  • MongoDB 5.0.8
  • Mongoose 6.3.1
  • Jest 28.0.1
  • SuperTest 6.2.3
  • Artillery 2.0.0
  • ESLint 8.2.0

Requirements

  • Docker 20

Installation

To install the project, run

docker-compose build

⚙️ This project uses a local MongoDB running in Docker. It is using a mongoimport to seed the Database with initial values from currencies.json (USD, BRL, EUR, BTC and ETH).

Usage

To run the project, run

docker-compose up

✔️ Done, now you'll be able to use the API using the Swagger UI at http://localhost:3000.

Testing

To run the automated tests (unit, integration and stress), run

npm test

🤖 This project also uses Github Actions to test it everytime a commit is pushed. The report html file for the stress test can be found in the actions artifacts.

Here is a snapshot of the results:

Unit tests

Jest was used for unit testing. All services and controllers were fully tested.

Unit tests

Integration tests

Supertest was used for integration testing. All routes fully tested (use cases).

Integration tests

Stress tests

Artillery was used for stress testing. With 5000 requests per second, 4490 requests were successfully completed.

Stress tests

API Documentation

🚀 Please refer to API Documentation.

To update the auto-generated API documentation (that is used by Swagger), run

npm run docs

About

Backend code challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.1%
  • Other 0.9%