https://github.com/arvindk2025/koinx_backend_assignment_
This Project is a Server Side Application that allows users to fetch all CryptoCurrency List , Facilitate Price Conversion on a particular date and Provides List of Companies that holds a specific CryptoCurrency.
https://github.com/arvindk2025/koinx_backend_assignment_
axios coingecko-api cors expressjs mongodb node-scheduler nodejs postman
Last synced: about 2 months ago
JSON representation
This Project is a Server Side Application that allows users to fetch all CryptoCurrency List , Facilitate Price Conversion on a particular date and Provides List of Companies that holds a specific CryptoCurrency.
- Host: GitHub
- URL: https://github.com/arvindk2025/koinx_backend_assignment_
- Owner: arvindk2025
- Created: 2024-04-10T08:46:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-17T17:34:21.000Z (about 2 years ago)
- Last Synced: 2024-05-30T08:08:28.738Z (about 2 years ago)
- Topics: axios, coingecko-api, cors, expressjs, mongodb, node-scheduler, nodejs, postman
- Language: JavaScript
- Homepage: https://koinx-backend-assignment-ah3d.onrender.com
- Size: 459 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KoinX Backend Assignment
This project is a server-side application that allows users:
1. To fetch all the Cryptocurrency lists from the Coingecko API :-
```
https://api.coingecko.com/api/v3/coins/list
```
2. To facilitate the Price Conversion of one Crypto Currency to another Crypto Currency
3. To fetch the List of Companies holding specific Cryptocurrencies Usin API :-
```
https://api.coingecko.com/api/v3/companies/public_treasury/${currency}
```
---
## Important Links:-
| Project Demo Video Link | https://asset.cloudinary.com/arvindkumar/ab0493dbc217b32244ee32153eb75307|
|---|---|
| Documentation.pdf Link |https://drive.google.com/file/d/10f-CJMNFoOYhdJ-j9CiXg49ACQ6u2XkS/view?usp=sharing|
|---|---|
| Project Hosted Link on Render |https://koinx-backend-assignment-ah3d.onrender.com/|
|---|---|
---
## Task 1: Fetch Cryptocurrency Names and IDs
1. Note:- Testing URL for POSTMAN for Task-1
```
Define PORT = 8000
http://localhost:8000/api/cryptocurrencylist
```
2. Fetching The Cryptocurrencies data from the Coingecko API :-
```
https://api.coingecko.com/api/v3/coins/list
```

3. And After Fetching Data I am storing fetched data in MongoDB Database in the name and Id's format.

4. **For updating the data at Every hour** we are using “node-shedule” package . This package
provides a flexible and powerful way to define rules for scheduling tasks at specific times or intervals.
5. We are using “schedule.shedulejob” method to update the data at every hour

---
## Task 2: Cryptocurrency Price Conversion API
1. Generated API that takes the Coingecko IDs of 2 cryptocurrencies and returns the price of one currency in another on a particular date.
(Price Conversion Logic is written in the `currencyConverter.controller.js` file under `controllers` folder.
```
Define PORT = 8000
http://localhost:8000/api/currencyCoverter
```
2. **Request Schema:**
```json
{
"fromCurrency": "bitcoin",
"toCurrency": "ethereum",
"date": "12-01-2024"
}
```
3. **Response:**
```json
{
"success": true,
"data":{
"convertedPrice": 17.688510609605387
}
}
```
4. Converted Price in POSTMAN during the Testing Verification

---
## Task 3: Companies Holding Cryptocurrency API
1. implemented an API that retrieves a list of companies holding a specific cryptocurrency.
```
Define PORT = 8000
http://localhost:8000/api/companies/public_treasury
```
2. Implemented the `getListofCompanies` function in the `listofCompaniesData.controller.js` file under `controllers` to handle the retrieval of company data.
3. Tested the API functionality using Postman.

#### Request and Response Examples
2. **Request Schema:**
```json
{
"currency": "bitcoin"
}
```
3. **Response:**
```json
{
"success": true,
"List of Companies that holds bitcoin": [
"MicroStrategy Inc.",
"Galaxy Digital Holdings",
"Marathon Digital Holdings",
"Tesla, Inc.",
"Hut 8 Mining Corp",
"Coinbase Global, Inc",
"Block Inc.",
"Riot Platforms, Inc",
"Hive Blockchain",
"CleanSpark Inc.",
"NEXON Co Ltd",
"Exodus Movement Inc",
"Meitu Inc",
"Bit Digital, Inc",
"Bitfarms Limited",
"NFT Investments PLC",
"Cipher Mining",
"DMG Blockchain Solutions Inc.",
"Neptune Digital Assets Corp.",
"BIGG Digital Assets Inc.",
"Advanced Bitcoin Technologies AG",
"FRMO Corp.",
"The Brooker Group",
"DigitalX",
"LQwD Technologies Corp",
"Cypherpunk Holdings Inc",
"Core Scientific",
"Mogo Inc."
]
}
```
---
# Testing: For Testing this Server App in POSTMAN use following URL
- **Task-1**: Get request to fetch All CryptoCurrency List
```
http://localhost:8000/api/cryptocurrencylist
```
- **Task-2** : Post request to convert one Currency to another
```
http://localhost:8000/api/currencyCoverter
```
- **Task-3** : Post request to fetch ListofCompanies
```
http://localhost:8000/api/companies/public_treasury
```
Or
## Testing: For Testing this Server App using Deployed Link in POSTMAN use following URL
- **Task-1**: Get request to fetch All CryptoCurrency List
```
https://koinx-backend-assignment-ah3d.onrender.com/api/cryptocurrencylist
```
- **Task-2** : Post request to convert one Currency to another
```
https://koinx-backend-assignment-ah3d.onrender.com/api/currencyCoverter
```
- **Task-3** : Post request to fetch ListofCompanies
```
https://koinx-backend-assignment-ah3d.onrender.com/api/companies/public_treasury
```
---
## Technologies Used
- Node.js
- Express.js
- MongoDB
- Coingecko API
- Render
- MongoDB Atlas
- POSTMAN
- Cors
- Axios
- Node-Schedule Package
- schedule.schedule job Method
---
# Installation & Steps to Run the Project Your Locally Storage
1. Download or Clone the repository:
```
git clone https://github.com/arvindk2025/KoinX_Backend_Assignment_.git
```
2. Install all the required dependencies:
```
npm install
```
3. Connect the MongoDB database by adding the Connection URL and PORT to the .env file (you can use MongoDB Atlas or Compass) :
```
MONGODB_URL = paste from connection string
PORT = 8000
```
4. Finally, Run the project:
```
npm start
```
Or
```
npm run start
```