package main import ( "fmt" "net/http" "strings" "go.wit.com/log" ) // remove '?' part and trailing '/' func cleanURL(url string) string { url = "/" + strings.Trim(url, "/") return url } func okHandler(w http.ResponseWriter, r *http.Request) { var route string route = cleanURL(r.URL.Path) if route == "/uptime" { } if route == "/start" { } log.Warn("does nothing yet =", route) fmt.Fprintln(w, "does nothing yet =", route) } // starts and sits waiting for HTTP requests func startHTTP() { http.HandleFunc("/", okHandler) p := fmt.Sprintf(":%d", argv.Port) log.Println("Running on port", p) err := http.ListenAndServe(p, nil) if err != nil { log.Println("Error starting server:", err) } }