21 lines
410 B
Go
21 lines
410 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){
|
|
var data map[string]interface{}
|
|
err := json.NewDecoder(r.Body).Decode(&data)
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
log.Default().Printf("Ref: %s", data["ref"])
|
|
})
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
}
|