It is a RESTful API with a single endpoint that fetches the data in the provided MongoDB collection and return the results in the requested format.
- express - Node.js web application framework
- mongoose - MongoDB object modelin for Node.js
- lodash - Utili# functions library for iterating arrays, objects & strings
- winston - Simple and universal logging library
Use the package manager npm to install project.
git clone https://github.com/berkbuyukdurak/getir-case-study.git
cd getir-case-study
npm install
To configure the project, you can use the files in the config directory.
There are 2 ways to run this project.
npm run devStart
npm run prodStart
If you want to run tests on the project, please use the following command.
npm test
GET <public-endpoint-url> or <localhost:<8080 or your preferred port which can be changed from config/env/>>
POST /api/records
{
"startDate": "2016-01-26",
"endDate": "2018-02-02",
"minCount": 2700,
"maxCount": 3000
}
{
"code":0,
"msg":"Success",
"records":[
{
"key":"TAKwGc6Jr4i8Z487",
"createdAt":"2017-01-28T01:22:14.398Z",
"totalCount":2800
},
{
"key":"NAeQ8eX7e5TEg7oH",
"createdAt":"2017-01-27T08:19:14.135Z",
"totalCount":2900
}
]
}
Integration and unit tests are conducted. Here is the results;
Test Suites: 4 passed, 4 total
Tests: 15 passed, 15 total
Snapshots: 0 total
Time: 5.802 s, estimated 6 s
Ran all test suites.
MIT