github.com/nathants/docker-trace@v0.0.0-20220831131939-668bc05a257b/examples/go-web/main.go (about) 1 package main 2 3 import ( 4 "log" 5 "net/http" 6 "strings" 7 ) 8 9 func Handler(w http.ResponseWriter, r *http.Request) { 10 token := strings.Split(r.URL.Path, "/hello/")[1] 11 w.WriteHeader(http.StatusOK) 12 _, _ = w.Write([]byte(token)) 13 } 14 15 func main() { 16 http.HandleFunc("/", Handler) 17 err := http.ListenAndServeTLS(":8080", "ssl.crt", "ssl.key", nil) 18 if err != nil { 19 log.Fatal("ListenAndServe: ", err) 20 } 21 }