notfall/main.go

27 lines
522 B
Go
Raw Normal View History

2022-01-16 10:55:37 +00:00
package main
import (
"encoding/json"
"fmt"
"net/http"
)
var lastData interface{}
func main() {
http.HandleFunc("/owntrack", func(writer http.ResponseWriter, request *http.Request) {
var p interface{}
err := json.NewDecoder(request.Body).Decode(&p)
if err != nil {
2022-01-16 10:56:34 +00:00
writer.WriteHeader(http.StatusInternalServerError)
return
2022-01-16 10:55:37 +00:00
}
fmt.Println(p)
})
http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
2022-01-16 11:06:26 +00:00
writer.Write([]byte("Hallo"))
2022-01-16 10:55:37 +00:00
})
http.ListenAndServe(":8080", nil)
}