filebrowser/hugo.go

30 lines
898 B
Go
Raw Normal View History

2016-06-21 15:01:46 +00:00
//go:generate go get github.com/jteeuwen/go-bindata
//go:generate go install github.com/jteeuwen/go-bindata/go-bindata
//go:generate go-bindata -pkg hugo -prefix "assets" -o binary.go assets/...
// Package hugo makes the bridge between the static website generator Hugo
// and the webserver Caddy, also providing an administrative user interface.
package hugo
2015-09-12 08:52:41 +00:00
import (
"net/http"
2016-06-21 14:28:15 +00:00
"github.com/hacdias/caddy-filemanager"
2016-06-07 15:08:52 +00:00
"github.com/mholt/caddy/caddyhttp/httpserver"
2015-09-12 08:52:41 +00:00
)
// Hugo contais the next middleware to be run and the configuration
// of the current one.
type Hugo struct {
2016-06-21 14:28:15 +00:00
FileManager *filemanager.FileManager
Next httpserver.Handler
Config *Config
2015-09-20 08:15:21 +00:00
}
2015-09-12 08:52:41 +00:00
// ServeHTTP is the main function of the whole plugin that routes every single
// request to its function.
func (h Hugo) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
2015-09-13 11:14:18 +00:00
2015-09-13 21:48:52 +00:00
return h.Next.ServeHTTP(w, r)
2015-09-13 11:14:18 +00:00
}