github.com/GoogleContainerTools/skaffold@v1.39.18/examples/multi-config-microservices/leeroy-web/web.go (about)

     1  package main
     2  
     3  import (
     4  	"io"
     5  	"net/http"
     6  
     7  	"log"
     8  )
     9  
    10  func handler(w http.ResponseWriter, r *http.Request) {
    11  	resp, err := http.Get("http://leeroy-app:50051")
    12  	if err != nil {
    13  		panic(err)
    14  	}
    15  	defer resp.Body.Close()
    16  	if _, err := io.Copy(w, resp.Body); err != nil {
    17  		panic(err)
    18  	}
    19  }
    20  
    21  func main() {
    22  	log.Print("leeroy web server ready")
    23  	http.HandleFunc("/", handler)
    24  	http.ListenAndServe(":8080", nil)
    25  }