cleanup
This commit is contained in:
@@ -27,7 +27,7 @@ func eventsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
io.WriteString(w, "ok")
|
||||
}
|
||||
|
||||
func healthHandler(w http.ResponseWriter, r *http.Request){
|
||||
func healthHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if healthyBool {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
io.WriteString(w, "true")
|
||||
@@ -37,7 +37,7 @@ func healthHandler(w http.ResponseWriter, r *http.Request){
|
||||
}
|
||||
}
|
||||
|
||||
func healthToggleHandler(w http.ResponseWriter, r *http.Request){
|
||||
func healthToggleHandler(w http.ResponseWriter, r *http.Request) {
|
||||
healthyBool = !healthyBool
|
||||
io.WriteString(w, "toggled")
|
||||
}
|
||||
|
||||
@@ -29,18 +29,12 @@ func NewServer(port string) (*Server, error) {
|
||||
return nil, errors.Wrap(err, "failed to create listener")
|
||||
}
|
||||
|
||||
// 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")
|
||||
|
||||
router := mux.NewRouter()
|
||||
router.HandleFunc("/events", eventsHandler).Methods("POST")
|
||||
router.HandleFunc("/health", healthHandler).Methods("GET")
|
||||
router.HandleFunc("/health/toggle", healthToggleHandler).Methods("GET")
|
||||
// router.HandleFunc("/schema/refresh", schemaRefreshHandler).Methods("POST")
|
||||
// router.HandleFunc("/stop", stopHandler).Methods("POST")
|
||||
|
||||
httpServer := &http.Server{Addr: ":" + port, Handler: router}
|
||||
newServer := &Server{HttpServer: httpServer, Listener: listener}
|
||||
|
||||
Reference in New Issue
Block a user