In the implementation you cand find two endpoints to rerquest for product and most viewed product of a MYSQL Database. Also, the API calculates the products prices in Cadadian Dollars by requesting the exchange rate to a a third-party API (https://currencylayer.com/documentation).
Notes:
- In the folder, it is a products.sql script to create the database model. Also, in the db.js setup your local database credentials
- Please in the product-api-test/services/httpCurrency.service change the API KEY
Libraries used:
- axios : ^1.6.7,
- express : ^4.18.2,
- mysql2 : ^3.9.1
$ npm installawait createConnection({
host: "localhost",
database: "localhost",
user: "root",
password: "root",
port: "3306"
});Change changeme with the API Key
await axios.get(`http://api.currencylayer.com/convert?access_key=changeme&from=USD&to=CAD&amount=1`);# development
$ node .\index.js
- Author - [Juan Fernando Castro - Test for Feufo]
Nest is MIT licensed.

