in api/main.go [28:41]
func (s *server) handleEmojis() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
endpoint := fmt.Sprintf("http://tracker.%s:3000/", os.Getenv("COPILOT_SERVICE_DISCOVERY_ENDPOINT"))
resp, err := http.Get(endpoint)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
w.WriteHeader(http.StatusOK)
w.Write(body)
}
}