github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2015/go-for-java-programmers/hello/server.go (about)

     1  // +build OMIT
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"log"
     8  	"net/http"
     9  )
    10  
    11  func main() {
    12  	http.HandleFunc("/hello", handleHello) // HL
    13  	fmt.Println("serving on http://localhost:7777/hello")
    14  	log.Fatal(http.ListenAndServe("localhost:7777", nil))
    15  }
    16  
    17  func handleHello(w http.ResponseWriter, req *http.Request) {
    18  	log.Println("serving", req.URL)
    19  	fmt.Fprintln(w, "Hello, 世界!") // HL
    20  }