Documentation ¶
Index ¶
- func ExecuteTemplate(name string, w io.Writer, data interface{})
- func FromForm(r *http.Request, s interface{}) error
- func LoadTemplates(files fs.FS)
- func SetHeader(parent http.Handler, kv ...string) http.Handler
- func SetHeaderMap(parent http.Handler, hdrs map[string]string) http.Handler
- func WithLogging(parent http.Handler) http.Handler
- func WriteJSON(w http.ResponseWriter, v interface{}) error
- type ParseError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteTemplate ¶
func LoadTemplates ¶
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, v interface{}) error
WriteJSON takes a struct in v, marshals it to JSON, and writes the output to w. It can be useful when writing HTTP handlers that output JSON. It calls http.Error to return a 500 error if the marshalling fails.
Types ¶
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
ParseError represents errors when parsing the values.
Click to show internal directories.
Click to hide internal directories.