diff --git a/handlers.go b/handlers.go index b2348681270..7dd3f4e7cc3 100644 --- a/handlers.go +++ b/handlers.go @@ -118,6 +118,18 @@ func GetHttpHandler(w http.ResponseWriter, req *http.Request) { } +func DeleteHttpHandler(w http.ResponseWriter, req *http.Request) { + vars := mux.Vars(req) + + debug("[recv] GET http://%v/delete/%s", server.Name(), vars["key"]) + + command := &DeleteCommand{} + command.Key = vars["key"] + + Dispatch(server, command, w) + +} + func Dispatch(server *raft.Server, command Command, w http.ResponseWriter) { var body []byte diff --git a/raftd.go b/raftd.go index e6787d851a5..a16d35bfdd8 100644 --- a/raftd.go +++ b/raftd.go @@ -130,7 +130,7 @@ func main() { // external commands r.HandleFunc("/set/{key}", SetHttpHandler).Methods("POST") r.HandleFunc("/get/{key}", GetHttpHandler).Methods("GET") - //r.HandleFunc("/delete/{key}", DeleteHttpHandler).Methods("GET") + r.HandleFunc("/delete/{key}", DeleteHttpHandler).Methods("GET") http.Handle("/", r) log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", info.Port), nil))