mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-09 17:32:51 +00:00
updated saving temperatures end point
This commit is contained in:
@@ -27,6 +27,11 @@ func HandleSensorRequest(w http.ResponseWriter, r *http.Request, ps httprouter.P
|
||||
|
||||
//get request parameters - convert temp to float64
|
||||
temperature, _ := strconv.ParseFloat(r.URL.Query().Get("temperature"), 64)
|
||||
if temperature < -50 {
|
||||
fmt.Fprint(w, "{ message: \"Bad temperature reading\"}")
|
||||
return
|
||||
}
|
||||
|
||||
location := r.URL.Query().Get("location")
|
||||
t := time.Now()
|
||||
|
||||
@@ -214,4 +219,4 @@ func createResponse(s []daily_sensor.Data, err error) string{
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user