This is a simple API by which will set the currency code(USD, EUR, BDT) as a parameter in the request query and in return user will get the following information in response:
- The current Bitcoin rate, in the requested currency.
- The lowest Bitcoin rate and date in the last 30 days, in the requested currency.
- The highest Bitcoin rate and date in the last 30 days, in the requested currency.
To create the API (/getBitcoinInfo), you need to set environment for Nodejs, and you must follow the steps below:
Step 1: Clone this repo by:
git clone https://github.com/mdmuhtasimfuadfahim/coindesk-test-api
Step 2: Change PORT according to your preference or leave it as it is.
Step 3: From the root directory, run the commands:
yarn install
yarn serve
The API will start and you can send request and get response.
Note: Please use
yarn add dependency_name or npm install dependency_name
if something went wrong withyarn install
.
From the root directory run the commad:
yarn test
Note: Please use the line:
const getCurrencyCode = req.body.currency;
in app.js file if you want to give request body using the API.