forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.go
38 lines (31 loc) · 834 Bytes
/
handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package getjoblessbuild
import (
"html/template"
"net/http"
"code.cloudfoundry.org/lager"
"github.com/concourse/atc/web"
)
type Handler struct {
logger lager.Logger
clientFactory web.ClientFactory
template *template.Template
}
func NewHandler(logger lager.Logger, clientFactory web.ClientFactory, template *template.Template) *Handler {
return &Handler{
logger: logger,
clientFactory: clientFactory,
template: template,
}
}
type TemplateData struct {
// no-op so the template can be reused until we elm-ify nav
PipelineName string
}
func (handler *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) error {
err := handler.template.Execute(w, TemplateData{})
if err != nil {
handler.logger.Fatal("failed-to-execute-jobless-build-template", err)
return err
}
return nil
}