add initial frontend

This commit is contained in:
2026-02-17 17:40:00 -08:00
parent 4b05aa7bf3
commit be7e8a3c33
20 changed files with 1971 additions and 0 deletions
+18
View File
@@ -44,6 +44,11 @@ type TestResponse struct {
Status string `json:"status"`
}
type LatestTemperatureResponse struct {
Temp int `json:"temp"`
}
func getEnv(key string) string {
val := os.Getenv(key)
if val == "" {
@@ -264,6 +269,19 @@ func main() {
json.NewEncoder(w).Encode(okStatus)
})
// GET /latest-temperature
http.HandleFunc("/latest-temperature", func(w http.ResponseWriter, r *http.Request) {
// testing api integration
if r.Method != http.MethodGet {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
okStatus := LatestTemperatureResponse{Temp: 69}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(okStatus)
})
// GET /test
http.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) {
// testing deployment pipeline