// Homework 32, problem 1: Three pages. // // Make three routes that answer only GET: the home page at /, a page at /about, // and a page at /contact. Each one replies with one line of plain text. Any // other path must give 404, including /contact/extra. // // Run with: go run exercises/32/homework/01-three-pages.go package main import ( "fmt" "net/http" ) func handleHome(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "TODO: replace this line") } // TODO: add handleAbout and handleContact here. func main() { // TODO: change this pattern, and add the two other routes. 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) } }