This repository is for RESTful API with a single endpoint which is hosted on Heroku and implemented with Node.js using Express.
Heroku link : https://getir-records-api.herokuapp.com
You can reach the API docs Heroku Swagger docs link : Heroku Swagger
- Complete basic structure
- Complete basic functionality.
- Add exception handling.
- Add logger.
- Add unit and integration tests.
- Add swagger documentation and update README.md .
- Deploy to Heroku.
- Added documentation.
First clone the repository then use the node package manager to install packages.
git clone https://github.com/getir-nodejs-bootcamp/getir-nodejs-bootcamp-graduation-project-buraksenb.git
cd getir-nodejs-bootcamp-graduation-project-buraksenb
npm install
The API can be run locally with development mode or normal mode.
# Normal node application mode
npm run serve
# Development mode with Nodemon
npm run dev
The API has unit and integration tests inside ./src/tests path. The tests can be conducted using Jest with:
npm run test
Method | Description | Required Body Fields |
---|---|---|
POST /records | Returns filtered records | startDate,endDate,minCount,maxCount |
Send POST request to https://getir-records-api.herokuapp.com/records.
{
"startDate": "2016-12-26",
"endDate": "2017-03-02",
"minCount": 100,
"maxCount": 200
}
Response body below with Http Status: OK 200.
{
"code": 0,
"msg": "Success",
"records": [
{
"key": "TAKwGc6Jr4i8Z487",
"createdAt": "2017-01-28T01:22:14.398Z",
"totalCount": 120
},
{
"key": "kOKMRjkB",
"createdAt": "2016-12-30T11:56:25.780Z",
"totalCount": 120
},
{
"key": "LSyjwviN",
"createdAt": "2016-12-30T01:31:07.831Z",
"totalCount": 116
},
{
"key": "JuFWNLyO",
"createdAt": "2016-12-26T18:26:11.183Z",
"totalCount": 102
}
]
}
Send POST request to https://getir-records-api.herokuapp.com/records.
{
"startDate": "2016-12-26",
"endDate": "2017-03-02",
"minCount": 200,
"maxCount": 100
}
Response body below with Http Status: BAD REQUEST 400.
{
"error": {
"message": "\"minCount\" must be less than ref:maxCount"
}
}
Send GET request to https://getir-records-api.herokuapp.com/records with empty body.
Response body below with Http Status: NOT FOUND 404.
{
"error": {
"message": "Requested resource has not been found"
}
}