##Steps to Run
- git clone repolink
- Run "npm install" to install npm modules
- Navigate inside of src folder
- Run "npm run start" to start the server.
##.env for Reference(has to be added inside root folder)
NODE_ENV=dev
PORT=7001
HOST=localhost:7001
MONGO_URI= mongodb+srv://challengeUser:[email protected]/getir-case-study?retryWrites=true
##** Log file generated for reference**
File:
info.log >>>
{"level":"info","message":"Application : listen : listening on 7001"}
{"level":"info","message":"BaseController : _initRouters : registering Routes"}
{"level":"info","message":"RecordController : _initRouters : registering Routes"}
{"level":"info","message":"Application : listen : listening on 7001"}
error.log >>>
{"level":"error","message":"ErrorHandler : error : 404 Url Not Found"}
##** Local Start up server page**
##RecordService Api
POST endpoint: /records/listRecords
Req Payload:
{"startDate": "2015-01-26", "endDate": "2018-02-02", "minCount": 24, "maxCount": 25 }
Response payload:
{
"code": 0,
"msg": "Success",
"record": [
{
"key": "NBctKdeL",
"createdAt": "2016-10-10T12:45:27.584Z",
"totalCount": 25
},
{
"key": "ZrSnbmMX",
"createdAt": "2015-04-25T13:40:01.587Z",
"totalCount": 24
}
]
}
##Enhancements to be done
- Testcase needs to be added for each file and coverage has to be generated
- Centralized detailed logger needs to be added.
- eslint needs to added.
- More refactored scripts can be added in Package.json.
- husky hooks needs to be added for checking coverage before pushing.
- rate-limilt can be implemented for public api if required.
- appmetrics an be added to see the performance.
- logging duration and showing apdex score in grafana panels can be helpful.
- Api Details needs to be documented in wiki.
##** Heroku Start up server page**
heroku url post deployment : https://getir-api-service.herokuapp.com/
heroku RecordSevice POST endpoint: https://getir-api-service.herokuapp.com/records/listRecords
##** Postman Sample **