boltcard/ping.go
2023-02-02 09:16:23 +00:00

20 lines
438 B
Go

package main
import (
"net/http"
)
func external_ping(w http.ResponseWriter, req *http.Request) {
ping(w, "external API")
}
func internal_ping(w http.ResponseWriter, req *http.Request) {
ping(w, "internal API")
}
func ping(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
jsonData := []byte(`{"status":"OK","pong":"` + message + `"}`)
w.Write(jsonData)
}