A RESTful API with a single endpoint that fetches the data in the provided MongoDB collection and return the results in the requested format
Endpoint : POST /api/v1/records
git clone the repository
cd into the folder
npm install
npm run dev
npm test
- given request payload is in desired format
- given request payload is in desired format but not match to any records
- given request payload's date format is wrong
- given request payload's count range format is wrong
- given request payload has extra fields
- given request payload has missing fields
POST /api/v1/records
{
"startDate": "2015-01-01",
"endDate": "2016-01-01",
"minCount": 0,
"maxCount": 10,
}
Parameter | Type | Description |
---|---|---|
startDate | String | format => YYYY-MM-DD & results will be gte |
endDate | String | format => YYYY-MM-DD & results will be lte |
minCount | Integer | results will be greater than minCount |
maxCount | Integer | results will be less than maxCount |
axios
.post("https://getir-case-study-burakkisacik.herokuapp.com/api/v1/records", {
startDate: "2015-01-01",
endDate: "2016-01-01",
minCount: 0,
maxCount: 10,
})
.then((response) => {
console.log(response.data);
});
{
code: 0,
msg: 'success',
records: [
{
key: 'nYYhzbmi',
createdAt: '2015-11-17T03:03:18.052Z',
totalCount: 4
}
]
}
- Node.js
- Express
- MongoDB
- Mongoose
- Jest & Supertest
- Winston & Morgan
- Cors, helmet, xss-clean, hpp, express-mongo-sanitize
- Colors
- dotenv