lil updates
Jes Olson j3s@c3f.net
Sat, 13 May 2023 22:36:55 -0700
M
main.go
→
main.go
@@ -8,10 +8,6 @@
func main() { s := New() mux := http.NewServeMux() - // since "/" is a wildcard, this anonymous function acts - // as a router for patterns that can't be registered at - // start time. e.g. /j3s or /j3s/feeds - // handles /, /<username>, and 404 mux.HandleFunc("/", s.rootHandler) mux.HandleFunc("/feeds", s.feedsHandler)
M
site.go
→
site.go
@@ -41,6 +41,10 @@ }
return &s } +// rootHandler is our "wildcard handler", so in addition to +// serving /, it also acts as a router for a few arbitrary +// patterns that can't be registered at starttime +// this includes /<username> and 404 func (s *Site) rootHandler(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/" { s.indexHandler(w, r)