github.com/solo-io/service-mesh-hub@v0.9.2/test/extensions/hello_server.go (about)

     1  package extensions
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  )
     7  
     8  func RunHelloServer(helloMsg string) error {
     9  	mux := http.NewServeMux()
    10  	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    11  		_, err := w.Write([]byte(helloMsg))
    12  		if err != nil {
    13  			http.Error(w, err.Error(), 500)
    14  		}
    15  	})
    16  	return http.ListenAndServe(fmt.Sprintf(":%v", HelloServerPort), mux)
    17  }