func runServer(ctx context.Context, log zerolog.Logger, addr string, api provisioner.API) error {
	mux := httprouter.New()
	mux.GET("/nodeinfo", getNodeInfoHandler(api))
	mux.POST("/info", getInfoHandler(api))
	mux.POST("/prepare", getPrepareHandler(api))
	mux.POST("/remove", getRemoveHandler(api))
	httpServer := &http.Server{
		Addr:    addr,
		Handler: mux,
	}
	serverErrors := make(chan error)
	go func() {
		defer close(serverErrors)
		log.Info().Msgf("Listening on %s", addr)
		if err := httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
			serverErrors <- errors.WithStack(err)
		}
	}()
	select {
	case err := <-serverErrors:
		return errors.WithStack(err)
	case <-ctx.Done():
		log.Debug().Msg("Closing server...")
		httpServer.Close()
		return nil
	}
}
runServer runs a HTTP server serving the given API
package service
import (
	"context"
	"encoding/json"
	"io/ioutil"
	"net/http"
	"github.com/arangodb/kube-arangodb/pkg/util/errors"
	"github.com/julienschmidt/httprouter"
	"github.com/rs/zerolog"
	"github.com/arangodb/kube-arangodb/pkg/storage/provisioner"
)
const (
	contentTypeJSON = "application/json"
)