updates
parent
b4cdd27fa3
commit
74a857d6ab
8
hugo.go
8
hugo.go
|
@ -14,21 +14,21 @@ func Setup(c *setup.Controller) (middleware.Middleware, error) {
|
||||||
commands.Execute()
|
commands.Execute()
|
||||||
|
|
||||||
return func(next middleware.Handler) middleware.Handler {
|
return func(next middleware.Handler) middleware.Handler {
|
||||||
return &handler{}
|
return &handler{
|
||||||
|
Next: next,
|
||||||
|
}
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type handler struct{}
|
type handler struct{ Next middleware.Handler }
|
||||||
type adminHandler struct{}
|
type adminHandler struct{}
|
||||||
|
|
||||||
func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||||
|
|
||||||
// do path matching
|
// do path matching
|
||||||
if middleware.Path(r.URL.Path).Matches("/admin") {
|
if middleware.Path(r.URL.Path).Matches("/admin") {
|
||||||
a := new(adminHandler)
|
a := new(adminHandler)
|
||||||
return a.ServeHTTP(w, r)
|
return a.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
http.ServeFile(w, r, "public"+r.URL.Path)
|
|
||||||
|
|
||||||
return 200, nil
|
return 200, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue