Beispiel #1
0
func deleteOneFunc(ws worker.WatchService) http.HandlerFunc {
	return func(w http.ResponseWriter, req *http.Request) {
		params := req.URL.Query()

		id, err := strconv.Atoi(params.Get(":id"))
		if err != nil {
			http.Error(w, err.Error(), GOOSE_ERROR)
			return
		}

		_, err = ws.Remove(id)
		if err != nil {
			http.Error(w, err.Error(), GOOSE_ERROR)
			return
		}

		w.WriteHeader(http.StatusNoContent)
	}
}