Skip to content

Instantly share code, notes, and snippets.

@shurane
Created May 17, 2022 03:24
Show Gist options
  • Select an option

  • Save shurane/12647ca82912a920034e505a84cee1c8 to your computer and use it in GitHub Desktop.

Select an option

Save shurane/12647ca82912a920034e505a84cee1c8 to your computer and use it in GitHub Desktop.

Revisions

  1. shurane created this gist May 17, 2022.
    26 changes: 26 additions & 0 deletions main.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    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))
    }