add a new test endpoint
testing deploy pipeline
This commit is contained in:
@@ -40,6 +40,10 @@ type HealthResponse struct {
|
|||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TestResponse struct {
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
func getEnv(key string) string {
|
func getEnv(key string) string {
|
||||||
val := os.Getenv(key)
|
val := os.Getenv(key)
|
||||||
if val == "" {
|
if val == "" {
|
||||||
@@ -260,6 +264,19 @@ func main() {
|
|||||||
json.NewEncoder(w).Encode(okStatus)
|
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
|
// GET /weather/history?city=London&limit=10
|
||||||
http.HandleFunc("/weather/history", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/weather/history", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != http.MethodGet {
|
if r.Method != http.MethodGet {
|
||||||
|
|||||||
Reference in New Issue
Block a user