code: func (h *Handler) serveGetInstances(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
  	// If the client is requesting a stream, then handle as a stream.
  	if strings.Contains(r.Header.Get("Accept"), "text/event-stream") {
  		h.serveStream(w, params, discoverd.EventKindUp|discoverd.EventKindUpdate|discoverd.EventKindDown)
  		return
  	}
  
  	// Otherwise read instances from the store.
  	instances, err := h.Store.Instances(params.ByName("service"))
  	if err != nil {
  		hh.Error(w, err)
  		return
  	} else if instances == nil {
  		hh.ObjectNotFoundError(w, fmt.Sprintf("service not found: %q", params.ByName("service")))
  		return
  	}
  
  	// Write instances to the response.
  	hh.JSON(w, 200, instances)
  }
docs: // serveGetInstances returns a list of all instances for a service.