Skip to content

Instantly share code, notes, and snippets.

@JNaeemGitonga
Created December 29, 2019 17:20
Show Gist options
  • Save JNaeemGitonga/8ce8aeb7c6b661649eb14bc1b32a48ff to your computer and use it in GitHub Desktop.
Save JNaeemGitonga/8ce8aeb7c6b661649eb14bc1b32a48ff to your computer and use it in GitHub Desktop.
func marshalJSONAndSend(res []Story) (events.APIGatewayProxyResponse, error) {..}
func marshalJSONAndSend(res []Story) (events.APIGatewayProxyResponse, error) {
response, err := json.Marshal(res)
if err != nil {
return handleError(err)
}
return events.APIGatewayProxyResponse{
Body: string(response),
StatusCode: 200,
}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment