Skip to content

Instantly share code, notes, and snippets.

@rogerwelin
Created November 24, 2020 22:09
Show Gist options
  • Save rogerwelin/f39f9d3276d4935f8e313ba31ebd441f to your computer and use it in GitHub Desktop.
Save rogerwelin/f39f9d3276d4935f8e313ba31ebd441f to your computer and use it in GitHub Desktop.
var Version = "dev"
type Message struct {
Msg string `json:"msg"`
Version string `json:"version"`
}
func pingHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
fmt.Fprintf(w, "pong")
}
func helloArgo(w http.ResponseWriter, r *http.Request) {
msg := &Message{Msg: "Hello ArgoCD!", Version: Version}
out, err := json.Marshal(msg)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
w.Write(out)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment