2019-04-30a few seconds read (About 94 words)How to run simple http server in GoIssue #220 Handle url parameter1234567891011121314151617181920212223242526package mainimport ( "net/http" "log")func handleGreeting(w http.ResponseWriter, r *http.Request) { messages, ok := r.URL.Query()["message"] if !ok || len(messages[0]) < 1 { log.Println("Message is missing") w.WriteHeader(400) return } message := messages[0] w.Write([]byte(message))}func main() { http.HandleFunc("/greet", handleGreeting) if err := http.ListenAndServe(":8080", nil); err != nil { panic(err) }} Handle body123456789101112type MyRequest struct { Message string `json:"message"`}decoder := json.NewDecoder(r.Body)var t EphemeralKeysRequesterr := decoder.Decode(&t)if err != nil { panic(err)}message := t.Message#go