github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/taste/hellohttp.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"log"
     6  	"net/http"
     7  )
     8  
     9  func HelloServer(w http.ResponseWriter, req *http.Request) {
    10  	log.Println(req.URL)
    11  	fmt.Fprintf(w, "Hello, 世界!\nURL = %s\n", req.URL)
    12  }
    13  
    14  func main() {
    15  	fmt.Println("please connect to localhost:7777/hello")
    16  	http.HandleFunc("/hello", HelloServer)
    17  	log.Fatal(http.ListenAndServe(":7777", nil))
    18  }