diff --git a/main.go b/main.go index cf4c5ccd7a381e4372738287a2566f49139c64d3..643cac9a5320e7904df5b2c59036b643d5360db5 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "html" "log" "net/http" "os" @@ -33,6 +34,7 @@ func urlSplitForCountry(a string)(string, string){ func defaultHandler(w http.ResponseWriter, r *http.Request){ //code to be added + fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) } func viewHandler(w http.ResponseWriter, r *http.Request) { @@ -82,7 +84,7 @@ var Start time.Time // Main function func main() { port := os.Getenv("PORT") - + if port == "" { //log.fatal formatting output and exits log.Fatal("$PORT must be set") @@ -94,7 +96,7 @@ func main() { // under the path / remember to end with trailing / // Add code to this function - http.HandleFunc("/conservation/v1/", defaultHandler) + http.HandleFunc("/", defaultHandler) http.HandleFunc("/conservation/v1/country/name/", viewHandler)