This commit is contained in:
Henrique Dias 2015-09-12 11:33:39 +01:00
parent b06a0e2b3d
commit 86f1554904
2 changed files with 7 additions and 4 deletions

View File

@ -1,3 +0,0 @@
0.0.0.0
hugo

View File

@ -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
}