fw

package
v0.0.0-...-dcdb1c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

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 interface{})

RenderHTML executes the given template, sending the output to the supplied response writer

func RenderJSON

func RenderJSON(w http.ResponseWriter, statusCode int, data interface{})

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL