Now worky

This commit is contained in:
Henri Burau
2024-06-04 14:49:57 +02:00
parent e2b9b8f176
commit b6555a1cc8
11 changed files with 58 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import (
"net/http"
"gitea.henriburau.de/haw-lan/cod4watcher/views/home"
"github.com/davecgh/go-spew/spew"
)
func (s *Server) HandleHome(w http.ResponseWriter, r *http.Request) error {
@ -12,5 +13,7 @@ func (s *Server) HandleHome(w http.ResponseWriter, r *http.Request) error {
return err
}
spew.Dump(r.Context())
return Render(w, r, home.Index(captureList))
}

15
routes/path_middleware.go Normal file
View File

@ -0,0 +1,15 @@
package routes
import (
"context"
"net/http"
"gitea.henriburau.de/haw-lan/cod4watcher/views"
)
func PathMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := context.WithValue(r.Context(), views.PathContext, r.URL.Path)
next.ServeHTTP(w, r.WithContext(ctx))
})
}