// DirectToTemplate is for use when you have a template which just needs to // be sent directly to the client without any specific logic taking place. // // Use-cases are things like error pages, small fragments etc. func DirectToTemplate(templatename string) bk.RouterHandler { filename := filepath.Join(connection_details.TemplateDirectory, templatename) if !exists(filename) { panic(fmt.Sprintf("Template does not exist: %s", filename)) } return func(self *bk.AppServer, w http.ResponseWriter, req *http.Request) error { return tmpl.Execute(w, templatename, nil) } }
func Index(self *bk.AppServer, w http.ResponseWriter, req *http.Request) error { return tmpl.Execute(w, "index.html", map[string]string{"STATIC_URL": connection_details.StaticURL}) }