controller

package module
v0.0.0-...-5973e5e Latest Latest
Warning

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

Go to latest
Published: May 3, 2016 License: MIT Imports: 4 Imported by: 1

README

Go View Controller

Simple implementation of a view controller in go. Organizing routing and view rendering. To use this module check out the spec directory for a example implementation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// Configuration
	Prefix   string
	Data     interface{}
	Res      http.ResponseWriter
	Req      *http.Request
	Routes   []Route
	Partials string

	// Oncall
	Params  map[string]string
	Options map[string][]string
}

func (*Controller) Mount

func (c *Controller) Mount(router *mux.Router)

func (*Controller) Raw

func (c *Controller) Raw(data string)

func (*Controller) Render

func (c *Controller) Render(name string) error

Render view to HTTP response writer.

func (*Controller) RenderError

func (c *Controller) RenderError(view string, err error) error

func (*Controller) Write

func (c *Controller) Write(data []byte) (int, error)

type Route

type Route struct {
	Path    string
	Method  string
	Handler func()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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