add a new test endpoint

testing deploy pipeline
This commit is contained in:
2026-02-12 23:56:54 -08:00
parent ef183ab1ce
commit 4b05aa7bf3
+17
View File
@@ -40,6 +40,10 @@ type HealthResponse struct {
Status string `json:"status"`
}
type TestResponse struct {
Status string `json:"status"`
}
func getEnv(key string) string {
val := os.Getenv(key)
if val == "" {
@@ -260,6 +264,19 @@ func main() {
json.NewEncoder(w).Encode(okStatus)
})
// GET /test
http.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) {
// testing deployment pipeline
if r.Method != http.MethodGet {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
okStatus := TestResponse{Status: "hello from go"}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(okStatus)
})
// GET /weather/history?city=London&limit=10
http.HandleFunc("/weather/history", func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {