view

package
v0.0.0-...-3cdf4da Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 13 Imported by: 0

README

View resource to render public files and/or views/templates.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type View

type View struct {
	yarf.Resource

	// Public files root path
	Public string

	// Views root path
	Views string

	// View components root path
	Components string
	Debug      bool

	sync.RWMutex
	// contains filtered or unexported fields
}

View is a yarf.Resource object that renders templates based on the request path.

func New

func New(p, v, c string) *View

New takes 3 strings for public, views and components paths respectively. Returns a new *View object properly configured.

func (*View) Get

func (v *View) Get(c *yarf.Context) error

Get implements yarf.Resource.Get() method to write a public file or a view to the response.

func (*View) Render

func (v *View) Render(route string, c *yarf.Context) error

Render writes a template to the response based on the request path. All components are available to use inside any template. If v.Debug == true, all templates and components are parsed every time, otherwise it will cache the first parse for all further requests.

Jump to

Keyboard shortcuts

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