Deployed url:
-
Clone the repository
git clone
-
Install the packages using the package manager of your choice (eg: npm, pnpm, yarn)
<package_manager> install
-
The env file is already included in the repository along with the env variables
DATABASE_URL
. The MongoDB instance has been deployed on Atlas. Incase you wish to use mongodb locally you many comment out the firstDATABASE_URL
and uncomment the second one (which is the local URL). -
To run the application use the command
npm run dev
or replace npm with the package manager you are using. The server will start at
localhost:3000
by default if no PORT is specified in the env file.
βββ πsrc
βββ app.ts
βββ config.ts
βββ πcontrollers
βββ tradeController.ts
βββ πdatabase
βββ dbConnect.ts
βββ πlib
βββ tradeCronService.ts
βββ πmiddleware
βββ errorHandler.ts
βββ πmodels
βββ tradeModel.ts
βββ πroutes
βββ tradeRoute.ts
- Live URL:
https://koinx-assign-1.onrender.com/api/v1/trades/upload
- Method:
POST
- Description: This endpoint allows you to upload a CSV file for processing.
Steps to Test:
- Use a tool like Postman or cURL to send a POST request.
- In Postman, select
POST
as the method and set the URL tohttp://13.201.56.56/api/upload
. - In the
Body
tab, selectform-data
, then chooseFile
as the type and upload a CSV file of your choice. - Send the request and check the response to ensure that the file is processed correctly and the data is uploaded to the database. screenshot-[https://asset.cloudinary.com/dvp9end1y/7b04e5fb948386750a3279bc04dbf51f]
- Live URL:
https://koinx-assign-1.onrender.com/api/v1/trades/balance
- Method:
POST
- Description: This endpoint retrieves the balance based on the timestamp provided in the request body.
Steps to Test:
-
Use a tool like Postman or cURL to send a POST request.
-
In Postman, select
POST
as the method and set the URL tohttp://localhost:3000/api/v1/trades/balance
. -
In the
Body
tab, selectraw
and chooseJSON
as the format. Enter the following JSON payload:{ "timestamp": "2022-09-29T00:00:00Z" }
-
Replace the
timestamp
with a valid ISO 8601 date-time string according to your data. -
Send the request and verify that the response contains the correct balance information based on the provided timestamp.
- Sample Request
curl curl --location 'https://koinx-assign-1.onrender.com/api/v1/trades/balance' \
--header 'Content-Type: application/json' \
--data '
{
"timestamp": "2022-09-29T00:00:00Z"
}'
screenshot-[https://asset.cloudinary.com/dvp9end1y/7b04e5fb948386750a3279bc04dbf51f]