github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2015/go4cpp/webserver.go (about)

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