add internal API & ping
This commit is contained in:
parent
53a8e1f581
commit
58c074234c
2 changed files with 54 additions and 10 deletions
20
ping.go
Normal file
20
ping.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue