write to kafka using request handler channel

This commit is contained in:
“nishant-sharma”
2021-03-30 16:03:09 +05:30
parent 503dfdee98
commit 5acd0d552e
6 changed files with 38 additions and 48 deletions

View File

@@ -6,6 +6,7 @@ import (
"sync"
"github.com/pkg/errors"
"github.com/gorilla/mux"
)
type Server struct {
@@ -28,16 +29,18 @@ func NewServer(port string) (*Server, error) {
return nil, errors.Wrap(err, "failed to create listener")
}
mux := http.NewServeMux()
mux.HandleFunc("/events", eventsHandler)
// mux := http.NewServeMux()
// mux.HandleFunc("/events", eventsHandler)
// mux.HandleFunc("/events", eventshandler).Methods("POST")
// mux.HandleFunc("/health", healthHandler).Methods("GET")
// mux.HandleFunc("/health/toggle", healthToggleHandler).Methods("POST")
// mux.HandleFunc("/refresh/schema", refreshSchemaHandler).Methods("POST")
// mux.HandleFunc("/stop", stopHandler).Methods("POST")
httpServer := &http.Server{Addr: ":" + port, Handler: mux}
router := mux.NewRouter()
router.HandleFunc("/events", eventsHandler).Methods("POST")
httpServer := &http.Server{Addr: ":" + port, Handler: router}
newServer := &Server{HttpServer: httpServer, Listener: listener}
return newServer, nil