1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| package main
import ( "fmt" "log" "net/http" _ "strings" )
func sayHi(w http.ResponseWriter, r *http.Request) { r.ParseForm() fmt.Println(r.Form)
for k, v := range r.Form { fmt.Println("key", k) fmt.Println("val", v) }
fmt.Fprintf(w, "Hello This is simple web") }
func main() { http.HandleFunc("/", sayHi)
err := http.ListenAndServe(":9090", nil) if err != nil { log.Fatal(err) } }
|