Phillip-England / templ-quickstart

Scaffold an http server using Go, HTMX, Templ, and Tailwind quick and easy.
160 stars 10 forks source link

Go HTTP Serve Mux routes are incorrect #1

Open ingyamilmolinar opened 5 months ago

ingyamilmolinar commented 5 months ago

It should be:

mux.HandleFunc("/favicon.ico", view.ServeFavicon)
mux.HandleFunc("/static/", view.ServeStaticFiles)
...

instead of:

mux.HandleFunc("GET /favicon.ico", view.ServeFavicon)
mux.HandleFunc("GET /static/", view.ServeStaticFiles)
...

I'm using go 1.21. Feel free to close if this works in Go 1.22.

Phillip-England commented 5 months ago

Hello! Yes so in Go 1.22+ you'll include the method in the string like: "GET /" or "POST /" ect. Thank you though!