func main() {
http.HandleFunc("/", foo)
http.ListenAndServe(":3000", nil)
}
func foo(w http.ResponseWriter, r *http.Request) {
s:= "name"
fp := path.Join("templates", "index.html")
tmpl, err := template.ParseFiles(fp)
if err != nil {
panic(err)
}
if err := tmpl.Execute(w, s); err != nil {
panic(err)
}
fmt.Println("successfull Operation!!")
}
This code displays 2 "successfull Operation!!" but when I add /home
(http.HandleFunc("/home", foo)
), it doesn't. I want to know why it displays "successfull Operation!!" twice. Thank you in advance.