Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
Serve requests using the given http.Server. If srv.Addr has the format `hostname:https`, then use autocert to manage certificates for the domain.
For http on port 80, you can use :http.
func ParseTemplateSet ¶
ParseTemplateSet parses sets of templates from an embed.FS.
Each directory constitutes a set of templates that are parsed together.
Structure (within a directory):
- share/* are always parsed.
- base.html will be parsed with each other file in same dir
Call a template with m[path].Execute(w, data) (root dir name is excluded).
For example, if you have
- /user/share/*
- /user/base.html
- /user/home.html
Then you call m["/user/home.html"].Execute(w, data).
func WithLogging ¶
func WithLogging(inner http.HandlerFunc) http.HandlerFunc
Types ¶
type CookieHandler ¶ added in v0.0.7
type CookieHandler struct { Secure bool SameSite http.SameSite // Defaults to strict. MaxAge int // Default 10 years }
func NewCookieHandler ¶ added in v0.0.7
func NewCookieHandler(listenAddr string) *CookieHandler
func (*CookieHandler) Get ¶ added in v0.0.7
func (h *CookieHandler) Get(r *http.Request, name string) string
func (*CookieHandler) Set ¶ added in v0.0.7
func (h *CookieHandler) Set(w http.ResponseWriter, name, value string)
Click to show internal directories.
Click to hide internal directories.