Now worky
This commit is contained in:
@ -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
15
routes/path_middleware.go
Normal 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))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user