MCPcopy
hub / github.com/writefreely/writefreely / NewHandler

Function NewHandler

handle.go:94–108  ·  view source on GitHub ↗

NewHandler returns a new Handler instance, using the given StaticPage data, and saving alias to the application's CookieStore.

(apper Apper)

Source from the content-addressed store, hash-verified

92// NewHandler returns a new Handler instance, using the given StaticPage data,
93// and saving alias to the application's CookieStore.
94func NewHandler(apper Apper) *Handler {
95 h := &Handler{
96 errors: &ErrorPages{
97 NotFound: template.Must(template.New("").Parse("{{define \"base\"}}<html><head><title>404</title></head><body><p>Not found.</p></body></html>{{end}}")),
98 Gone: template.Must(template.New("").Parse("{{define \"base\"}}<html><head><title>410</title></head><body><p>Gone.</p></body></html>{{end}}")),
99 InternalServerError: template.Must(template.New("").Parse("{{define \"base\"}}<html><head><title>500</title></head><body><p>Internal server error.</p></body></html>{{end}}")),
100 UnavailableError: template.Must(template.New("").Parse("{{define \"base\"}}<html><head><title>503</title></head><body><p>Service is temporarily unavailable.</p></body></html>{{end}}")),
101 Blank: template.Must(template.New("").Parse("{{define \"base\"}}<html><head><title>{{.Title}}</title></head><body><p>{{.Content}}</p></body></html>{{end}}")),
102 },
103 sessionStore: apper.App().SessionStore(),
104 app: apper,
105 }
106
107 return h
108}
109
110// NewWFHandler returns a new Handler instance, using WriteFreely template files.
111// You MUST call writefreely.InitTemplates() before this.

Callers 1

NewWFHandlerFunction · 0.85

Calls 2

SessionStoreMethod · 0.65
AppMethod · 0.65

Tested by

no test coverage detected