Created
November 24, 2020 22:09
-
-
Save rogerwelin/f39f9d3276d4935f8e313ba31ebd441f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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