func AddIndexEndpoints(r *mux.Router, env *Env) *mux.Router {
	h := func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "%s\n", env.Hostname)
	}
	r.HandleFunc("/", h)
	return r
}
AddIndexEndpoints adds the entrypoint/index handlers to the given router.
package centiment
import (
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"runtime/pprof"
	"time"
	"unicode/utf8"
	"github.com/go-kit/kit/log"
	"github.com/gorilla/mux"
	"github.com/gosimple/slug"
	"github.com/pkg/errors"
)
type Env struct {
	DB       DB
	Hostname string
	Logger   log.Logger
}
type Endpoint struct {
	Env     *Env
	Handler func(*Env, http.ResponseWriter, *http.Request) error
}
type HTTPError struct {
	Code int   `json:"code"`
	Err  error `json:"error"`
}
func (he HTTPError) Error() string {
	return fmt.Sprintf("code=%d err=%s", he.Code, he.Err)
}
func (he HTTPError) JSON() ([]byte, error) {
	return json.Marshal(he)
}
func (ep *Endpoint) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	if err := ep.Handler(ep.Env, w, r); err != nil {
		switch e := err.(type) {
		case HTTPError:
			w.Header().Set("Content-Type", "application/json")
			b, err := e.JSON()
			if err != nil {
				serverError(w)
			}
			w.Write(b)
		default:
			ep.Env.Logger.Log("err", err, "msg", "serverError")
			serverError(w)
		}
		return
	}
}