// Homework 31, problem 3: Echo the path. // // Reply with the method and the path of the request, in a line like: // GET /some/page // Use r.Method and r.URL.Path. Try three different paths in the browser. // // Run with: go run exercises/40/homework/03-echo-the-path.go package main import ( "fmt" "net/http" ) func handleHome(w http.ResponseWriter, r *http.Request) { // TODO: write your reply here, in place of this placeholder line: fmt.Fprintln(w, "TODO: replace this line") } func main() { http.HandleFunc("/", handleHome) fmt.Println("Server running at http://localhost:8080") fmt.Println("Press Ctrl+C to stop it.") err := http.ListenAndServe("localhost:8080", nil) if err != nil { fmt.Println("Server stopped:", err) } }