github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2012/chat/support/hello-web.go (about)

     1  // +build OMIT
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"log"
     8  	"net/http"
     9  )
    10  
    11  const listenAddr = "localhost:4000"
    12  
    13  func main() {
    14  	http.HandleFunc("/", handler)
    15  	err := http.ListenAndServe(listenAddr, nil)
    16  	if err != nil {
    17  		log.Fatal(err)
    18  	}
    19  }
    20  
    21  func handler(w http.ResponseWriter, r *http.Request) {
    22  	fmt.Fprint(w, "Hello, web")
    23  }