Changes related mainly to status codes

This commit is contained in:
emirbarucija
2018-05-23 18:56:12 +02:00
parent 20ab74f392
commit 9ac172bcb0
8 changed files with 14 additions and 14 deletions

View File

@@ -37,15 +37,16 @@ func main() {
func Handler() (events.APIGatewayProxyResponse, error) {
// Getting JSON as []byte
b, err := convertTasksToJSON()
if err != nil {
fmt.Println("error:", err)
b, err := convertTasksToJSON()
status := 200
if err != nil {
status = 500
}
return events.APIGatewayProxyResponse {
Body: string(b[:]),
StatusCode: 200,
}, nil
StatusCode: status,
}, err
}
func convertTasksToJSON() ([]byte, error) {

View File

@@ -15,5 +15,5 @@ functions:
handler: bin/Task_API
events:
- http:
path: /tasks
method: get
path: tasks
method: GET