I also have a GET route:
http.HandleFunc("GET /", getAllBooks)
func getAllBooks(w http.ResponseWriter, req *http.Request) {
fmt.Println("GET Request - getAllBooks")
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
for i, book := range books {
json.NewEncoder(w).Encode([]byte(i + ": " + book.title))
}
}
But when I call it I get this: