Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderError ¶
func RenderError(w http.ResponseWriter, statusCode int, err error)
RenderError outputs an error message
func RenderHTML ¶
func RenderHTML(w http.ResponseWriter, t *template.Template, data any)
RenderHTML executes the given template, sending the output to the supplied response writer
func RenderJSON ¶
func RenderJSON(w http.ResponseWriter, statusCode int, data any)
RenderJSON outputs the given data as JSON
Types ¶
type Topic ¶
type Topic interface { // Title returns the title for the area, which will be used in the sidenav and window title. Title() string // Prefix is the name used to reference this functionality in URLs. Prefix() string // Activate triggers a topic to register itself to receive traffic. Activate(TopicContext) }
Topic is used to describe a single major ControlZ functional area.
type TopicContext ¶
type TopicContext interface { // HTMLRouter is used to control HTML traffic delivered to this topic. HTMLRouter() *mux.Router // JSONRouter is used to control HTML traffic delivered to this topic. JSONRouter() *mux.Router // Layout is the template used as the primary layout for the topic's HTML content. Layout() *template.Template }
TopicContext provides support objects needed to register a topic.
func NewContext ¶
func NewContext(htmlRouter *mux.Router, jsonRouter *mux.Router, layout *template.Template) TopicContext
NewContext creates a new TopicContext.
Click to show internal directories.
Click to hide internal directories.