You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/api/http/handler/storybook/handler.go

24 lines
468 B

package storybook
import (
"net/http"
"path"
)
// Handler represents an HTTP API handler for managing static files.
type Handler struct {
http.Handler
}
// NewHandler creates a handler to serve static files.
func NewHandler(assetsPath string) *Handler {
h := &Handler{
http.FileServer(http.Dir(path.Join(assetsPath, "storybook"))),
}
return h
}
func (handler *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
handler.Handler.ServeHTTP(w, r)
}