getir-go-app
This application has Following Endpoints
- records (POST) Filters and fetches data from mongoDB
- pair (GET/POST) Creates and fetches data from an in memory DB
Set up and run
The app will start listining to ":9999"
Run test
- export DEV=1
- go test ./apis
EndPoints
1. In Memory DB endpoints
1.1 POST
Parameters |
Description |
key |
string |
value |
string |
Request
https://salty-eyrie-76135.herokuapp.com/api/v1/pair
Request Payload
{
"key": "active-tabs",
"value": "getir"
}
Error Responses
Status |
Response |
403 |
{ "message": "key already exists"} |
400 |
{ "message": "{field} value is invalid"} |
1.2 GET
Request
Parameters |
Description |
key |
string |
https://salty-eyrie-76135.herokuapp.com/api/v1/pair?key=active-tabs
Error Responses
Status |
Response |
404 |
{ "message": "key not found"} |
2. Mongo DB endpoints
2.1 POST
Request Payload
Parameters |
Description |
startDate |
Date (YYYY-MM-DD) |
endDate |
Date (YYYY-MM-DD) |
minCount |
int |
maxCount |
int |
{
"startDate": "2016-01-26",
"endDate": "2018-02-02",
"minCount": 2700,
"maxCount": 3000
}
Response Payload
{
"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
}
]
}
Error Responses
Status |
Response |
500 |
{ "message": "records not found"} |
400 |
{ "message": "{field} value is invalid"} |
400 |
{ "message": "parsing time {value} as \"2006-01-02\": cannot parse {value} as \"2006\"} |
LICENSE