in handlers/apigateway.go [36:52]
func (l *APIGatewayV2Handler) GetHandler(ctx context.Context, event events.APIGatewayV2HTTPRequest) (events.APIGatewayV2HTTPResponse, error) {
id, ok := event.PathParameters["id"]
if !ok {
return errResponse(http.StatusBadRequest, "missing 'id' parameter in path"), nil
}
product, err := l.products.GetProduct(ctx, id)
if err != nil {
return errResponse(http.StatusInternalServerError, err.Error()), nil
}
if product == nil {
return errResponse(http.StatusNotFound, "product not found"), nil
} else {
return response(http.StatusOK, product), nil
}
}