Here's an example of how to create an HTTP server using the net/http
package in Go and read the request body as form url-encoded:
main.go662 chars30 lines
In the http.HandleFunc
callback function, we first parse the request body using r.ParseForm()
. This populates the r.PostForm
map with the form-encoded values. We then log these values and send a "Hello, World!" response. Finally, we start the server using http.ListenAndServe
.
gistlibby LogSnag