server1.go 259 B

12345678910111213141516
  1. package main
  2. import (
  3. "fmt"
  4. "log"
  5. "net/http"
  6. )
  7. func main() {
  8. http.HandleFunc("/", handler)
  9. log.Fatal(http.ListenAndServe("localhost:8000", nil))
  10. }
  11. func handler(w http.ResponseWriter, r *http.Request) {
  12. fmt.Fprintf(w, "URL.Path = %q\n", r.URL.Path)
  13. }