code: func (h *Handler) handleGetNodes(w http.ResponseWriter, r *http.Request) {
  	if !validHeaderAcceptJSON(r.Header) {
  		http.Error(w, "JSON only acceptable response", http.StatusNotAcceptable)
  		return
  	}
  
  	// Retrieve all nodes.
  	nodes := h.api.Hosts(r.Context())
  
  	// Write to response.
  	if err := json.NewEncoder(w).Encode(nodes); err != nil {
  		h.logger.Printf("json write error: %s", err)
  	}
  }
docs: // handleGetNodes handles /internal/nodes requests.