mirror of
https://github.com/jimeh/ozu.io.git
synced 2026-02-19 08:06:39 +00:00
Extract template setup into it's own function
This commit is contained in:
@@ -15,6 +15,11 @@ import (
|
||||
|
||||
// NewHandler creates a new Handler object.
|
||||
func NewHandler(s shortener.Shortener) *Handler {
|
||||
t := newHandlerTemplate()
|
||||
return &Handler{s, t}
|
||||
}
|
||||
|
||||
func newHandlerTemplate() *template.Template {
|
||||
t := template.New("base")
|
||||
|
||||
files, err := AssetDir("templates")
|
||||
@@ -31,7 +36,7 @@ func NewHandler(s shortener.Shortener) *Handler {
|
||||
t.New(f).Parse(string(content))
|
||||
}
|
||||
|
||||
return &Handler{s, t}
|
||||
return t
|
||||
}
|
||||
|
||||
// Handler handle HTTP requests.
|
||||
|
||||
Reference in New Issue
Block a user