package main import ( "fmt" "net/http" ) func main() { http.HandleFunc("/a", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./index.html") }) http.HandleFunc("/b", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("B")) }) fmt.Println("Listening on port 8080") err := http.ListenAndServe(":8080", nil) if err != nil { panic(err.Error()) } fmt.Println("Stopped!") }