func (t *HTTPTransport) RegisterEndpoints(m endpoint.Middleware) error {
	opts := []kithttp.ServerOption{
		kithttp.ServerBefore(kithttp.PopulateRequestContext),
	}
	opts = append(opts, t.opts...)
	for _, ep := range t.endpoints {
		encoder := t.cfg.EncodeResponse
		if ep.encoder != nil {
			encoder = ep.encoder
		}
		t.mux.Handle(ep.method, ep.path,
			kithttp.NewServer(
				m(ep.endpoint),
				ep.decoder,
				encoder,
				append(opts, ep.options...)...))
	}
	t.mux.Handle("GET", t.cfg.LivenessCheckPath, t.liveness)
	t.mux.Handle("GET", t.cfg.ReadinessCheckPath, t.readiness)
	registerPProf(t.cfg, t.mux)
	return nil
}
RegisterEndpoints registers all configured endpoints, wraps them with the m middleware.
package kitty
import (
	"context"
	"fmt"
	"net/http"
	"net/http/pprof"
	"github.com/go-kit/kit/endpoint"
	kithttp "github.com/go-kit/kit/transport/http"
)
type HTTPTransport struct {
	cfg Config
	opts []kithttp.ServerOption
	endpoints []*httpendpoint
	httpmiddleware func(http.Handler) http.Handler
	mux            Router
	svr            *http.Server
	liveness  http.HandlerFunc
	readiness http.HandlerFunc
}
var _ Transport = &HTTPTransport{}
func nopHTTPMiddleWare(h http.Handler) http.Handler {
	return h
}
func (t *HTTPTransport) HTTPMiddlewares(m ...func(http.Handler) http.Handler) *HTTPTransport {
	t.httpmiddleware = func(next http.Handler) http.Handler {
		for i := len(m) - 1; i >= 0; i-- {
			next = m[i](next)
		}
		return next
	}
	return t
}
func NewHTTPTransport(cfg Config) *HTTPTransport {
	t := &HTTPTransport{
		cfg:            DefaultConfig,
		httpmiddleware: nopHTTPMiddleWare,
		mux:            StdlibRouter(),
		liveness:       defaultHealthcheck,
		readiness:      defaultHealthcheck,
	}
	if cfg.HTTPPort > 0 {
		t.cfg.HTTPPort = cfg.HTTPPort
	}
	if cfg.LivenessCheckPath != "" {
		t.cfg.LivenessCheckPath = cfg.LivenessCheckPath
	}
	if cfg.ReadinessCheckPath != "" {
		t.cfg.ReadinessCheckPath = cfg.ReadinessCheckPath
	}
	t.cfg.EnablePProf = cfg.EnablePProf
	if cfg.EncodeResponse != nil {
		t.cfg.EncodeResponse = cfg.EncodeResponse
	}
	return t
}
func (t *HTTPTransport) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	t.httpmiddleware(t.mux).ServeHTTP(w, r)
}