Skip to content

Instantly share code, notes, and snippets.

@bykof
Last active February 18, 2020 10:49
Show Gist options
  • Save bykof/903a37b9276887c16641f884ba950218 to your computer and use it in GitHub Desktop.
Save bykof/903a37b9276887c16641f884ba950218 to your computer and use it in GitHub Desktop.
package infrastructure
import (
"dashboard/order/domain/entity"
"encoding/json"
"fmt"
"net/http"
)
type OrderService struct{}
func (orderService OrderService) GetOrder(id string) (entity.Order, error) {
var order entity.Order
response, err := http.Get(fmt.Sprintf("order-service/orders/%s", id))
if err != nil {
return order, err
}
defer response.Body.Close()
err = json.NewDecoder(response.Body).Decode(&order)
if err != nil {
return order, err
}
return order, err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment