Skip to content

Instantly share code, notes, and snippets.

@shurane
Created May 17, 2022 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shurane/12647ca82912a920034e505a84cee1c8 to your computer and use it in GitHub Desktop.
Save shurane/12647ca82912a920034e505a84cee1c8 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"html"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
// r.ParseMultipartForm()
r.ParseForm()
for k, v := range r.PostForm {
log.Print("PostForm Key: ", k)
log.Println("Value: ", v)
}
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
})
log.Println("Listening on localhost:8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment