Documentation ¶
Index ¶
- Variables
- func LoadStaticFile(path string) error
- func LoadStaticFiles() error
- func Static(file string) string
- type Server
- func (s *Server) ListenAndServe() error
- func (s *Server) LoadTemplate(tmpl string) *template.Template
- func (s *Server) LoadTemplates()
- func (s *Server) RenderTemplate(w http.ResponseWriter, tmpl string, data map[string]any)
- func (s *Server) RenderTemplateFragment(w http.ResponseWriter, tmpl string, fragment string, data map[string]any)
- type StaticHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BaseTemplateName = "base.html" TemplateDir = "web/templates/" StaticDir = "web/static/" // static file source StaticFilesDir = "web/staticfiles/" // hashed/compressed static files )
View Source
var StaticFiles = make(map[string]string)
Functions ¶
func LoadStaticFile ¶
func LoadStaticFiles ¶
func LoadStaticFiles() error
Types ¶
type Server ¶
type Server struct { Development bool Port string Mux *http.ServeMux TemplateDir string Templates map[string]*template.Template BaseTemplateName string FuncMap template.FuncMap StaticDir string }
func (*Server) ListenAndServe ¶
func (*Server) LoadTemplates ¶
func (s *Server) LoadTemplates()
func (*Server) RenderTemplate ¶
func (*Server) RenderTemplateFragment ¶
type StaticHandler ¶
type StaticHandler struct{}
func (*StaticHandler) ServeHTTP ¶
func (sh *StaticHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.