mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-10 18:02:51 +00:00
updated saving temperatures end point
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ npm-debug.log
|
|||||||
mywebsite
|
mywebsite
|
||||||
tls.key
|
tls.key
|
||||||
tls.crt
|
tls.crt
|
||||||
|
stats.html
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ func HandleSensorRequest(w http.ResponseWriter, r *http.Request, ps httprouter.P
|
|||||||
|
|
||||||
//get request parameters - convert temp to float64
|
//get request parameters - convert temp to float64
|
||||||
temperature, _ := strconv.ParseFloat(r.URL.Query().Get("temperature"), 64)
|
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")
|
location := r.URL.Query().Get("location")
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user