func RemoveTransaction(srv *server.Server) (handle server.Handler) {
	return func(w http.ResponseWriter, r *http.Request, p server.Params) {
		defer r.Body.Close()
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.Header().Set("X-Content-Type-Options", "nosniff")
		var result Result
		name := p.ByName("name")
		err := srv.Manager().RemoveTransaction(name)
		if err != nil {
			httpError(w, err, http.StatusNotFound)
			return
		}
		result.Message = "removed"
		buf, err := json.Marshal(&result)
		if err != nil {
			httpError(w, fmt.Errorf("error serializing results: %w", err), http.StatusInternalServerError)
		}
		w.WriteHeader(http.StatusOK)
		w.Write(buf)
	}
}
RemoveTransaction removes a named transaction from the replicant manager
package api
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"github.com/brunotm/replicant/server"
	"github.com/brunotm/replicant/transaction"
	"gopkg.in/yaml.v2"
)
func AddTransaction(srv *server.Server) (handle server.Handler) {
	return func(w http.ResponseWriter, r *http.Request, p server.Params) {
		defer r.Body.Close()
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.Header().Set("X-Content-Type-Options", "nosniff")
		var result Result
		var err error
		var buf []byte
		if buf, err = ioutil.ReadAll(r.Body); err != nil {
			httpError(w, fmt.Errorf("error reading request body: %w", err), http.StatusBadRequest)
			return
		}
		config := transaction.Config{}
		switch r.Header.Get("Content-Type") {
		case "application/json":
			if err = json.Unmarshal(buf, &config); err != nil {
				httpError(w, fmt.Errorf("error deserializing json request body: %w", err), http.StatusBadRequest)
				return
			}
		case "application/yaml":
			if err = yaml.Unmarshal(buf, &config); err != nil {
				httpError(w, fmt.Errorf("error deserializing yaml request body: %w", err), http.StatusBadRequest)
				return
			}
		default:
			httpError(w, fmt.Errorf("unknown Content-Type"), http.StatusBadRequest)
			return
		}
		err = srv.Manager().AddFromConfig(config)
		if err != nil {
			httpError(w, err, http.StatusBadRequest)
			return
		}
		result.Message = "transaction created"
		buf, err = json.Marshal(&result)
		if err != nil {
			httpError(w, fmt.Errorf("error serializing results: %w", err), http.StatusInternalServerError)
		}
		w.WriteHeader(http.StatusCreated)
		w.Write(buf)
	}
}
func GetTransaction(srv *server.Server) (handle server.Handler) {
	return func(w http.ResponseWriter, r *http.Request, p server.Params) {
		defer r.Body.Close()
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.Header().Set("X-Content-Type-Options", "nosniff")
		var result Result
		name := p.ByName("name")
		config, err := srv.Manager().GetTransactionConfig(name)
		if err != nil {
			httpError(w, err, http.StatusNotFound)
			return
		}
		result.Data = []transaction.Config{config}
		buf, err := json.Marshal(&result)
		if err != nil {
			httpError(w, fmt.Errorf("error serializing results: %w", err), http.StatusInternalServerError)
		}
		w.WriteHeader(http.StatusOK)
		w.Write(buf)
	}
}
func GetTransactions(srv *server.Server) (handle server.Handler) {
	return func(w http.ResponseWriter, r *http.Request, p server.Params) {
		defer r.Body.Close()
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.Header().Set("X-Content-Type-Options", "nosniff")
		var result Result
		result.Data = srv.Manager().GetTransactionsConfig()
		buf, err := json.Marshal(&result)
		if err != nil {
			httpError(w, fmt.Errorf("error serializing results: %w", err), http.StatusInternalServerError)
		}
		w.WriteHeader(http.StatusOK)
		w.Write(buf)
	}
}