hugo
This commit is contained in:
parent
b06a0e2b3d
commit
86f1554904
8
hugo.go
8
hugo.go
|
@ -3,11 +3,17 @@ package hugo
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/spf13/hugo/commands"
|
||||
|
||||
"github.com/mholt/caddy/config/setup"
|
||||
"github.com/mholt/caddy/middleware"
|
||||
)
|
||||
|
||||
func Setup(c *setup.Controller) (middleware.Middleware, error) {
|
||||
for c.Next() {
|
||||
commands.Execute()
|
||||
}
|
||||
|
||||
return func(next middleware.Handler) middleware.Handler {
|
||||
return &handler{}
|
||||
}, nil
|
||||
|
@ -16,6 +22,6 @@ func Setup(c *setup.Controller) (middleware.Middleware, error) {
|
|||
type handler struct{}
|
||||
|
||||
func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
w.Write([]byte("Hello, I'm a caddy middleware"))
|
||||
http.ServeFile(w, r, "public"+r.URL.Path)
|
||||
return 200, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue