Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express Logo + MySQL Logo

Basic API - MySQL Connection using Express and NodeJS Javascript

Description

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:

  1. In the folder, it is a products.sql script to create the database model. Also, in the db.js setup your local database credentials
  2. 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

Installation

$ npm install

Database connection config params

await createConnection({
    host: "localhost",
    database: "localhost",
    user: "root",
    password: "root",
    port: "3306"
});

Axios Http URL config

Change changeme with the API Key

await axios.get(`http://api.currencylayer.com/convert?access_key=changeme&from=USD&to=CAD&amount=1`);

Running the app

# development
$ node .\index.js

Stay in touch

  • Author - [Juan Fernando Castro - Test for Feufo]

License

Nest is MIT licensed.

About

Basic API - MySQL Connection using Express and NodeJS Javascript

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages