Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandlerFunc ¶
func NewHandlerFunc(path string, opts *Options) (http.HandlerFunc, error)
NewHandlerFunc returns an http.HandlerFunc that does very simple pages serving from the specified path. The pageData function can be used to return template data.
Types ¶
type Options ¶
type Options struct {
LogOutput io.Writer
PageData func(page *Page) error
FuncMap map[string]interface{}
AllowGzip bool
RedirectHost string
CacheControl func(path string) string
// APIEndpoints are all the endpoints that are not backed by an html
// template.
APIEndpoints []string
EmbeddedFS FS
}
Options for the handler
type Page ¶
type Page struct {
Input struct {
Error error
NotFound bool
RootPath string
LocalPath string
ContentType string
Request *http.Request
}
Output struct {
Cookies []*http.Cookie
Data interface{}
}
}
A Page is passed to the pageData function
func (*Page) NotFound ¶ added in v0.15.0
func (p *Page) NotFound()
NotFound force displays 404 Not Found.
Click to show internal directories.
Click to hide internal directories.