A RESTful API with a single endpoint that fetches the data in a MongoDB collection
- User can fetch records filtered by
startDate
,endDate
,minCount
andmaxCount
.
Every response has a code
which can be one of the following:
- 0 - Success
- 400 - Bad request
- 404 - Not Found
- 500 - Internal Server Error
-
POST:
/records
- Request Body
{ "startDate": "2016-01-21", // Date 'YYYY-MM-DD` "endDate": "2019-01-21", // Date 'YYYY-MM-DD` "minCount": 200, // number "maxCount": 2000 // number }
- Sample response
{ "code": 0, "msg": "Success", "records": [ { "key": "TAKwGc6Jr4i8Z487", "createdAt": "2017-01-28T01:22:14.398Z", "totalCount": 310 }, ... ] }
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
What things you need to install the software and how to install them To get the project up and running, you need to have mongodb, nodejs and npm installed on your local machine.
Run the following commands to confirm installations.
node -v
- should display Node version
npm -v
- should display npm version
mongo --version
- should display mongdb version
- Clone the repository
git clone https://github.com/kenzdozz/getir-challenge.git
- Navigate to the location of the folder
- Run
npm install
to install dependencies - Run
npm start
to get the app started on your local machine
Rename .env.example
to .env
and update the variables accordingly
To run the tests, run the command
npm run test
The tests, test the api endpoints to ensure that it works and returns the required data.
- Nodejs - Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
- Express - Fast, unopinionated, minimalist web framework for Node.js
- MongoDB - MongoDB is a cross-platform document-oriented database program
- Onah Kenneth - Initial work - getir-challenge
This project is licensed under the MIT License