page

package
v0.0.0-...-74d7545 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyedTemplates = map[string]string{
	"::empty::":       "",
	"::placeholder::": "<h1>Placeholder</h1> <p>Please run <code>go generate github.com/rur/treetop-demo/...</code></p>",
}

Functions

func BaseHandler

func BaseHandler(rsp treetop.Response, req *http.Request) interface{}

BaseHandler can be used as a handler by multiple pages

Types

type Helper

type Helper struct {
	Env *site.Env
	// EDITME: if you wish to use a different router library
	Mux *http.ServeMux
}

Helper is passed to page Routes functions at startup for binding handlers and paths

func (Helper) BindEnv

BindEnv will inject the sever environment to a treetop request handler using closures

func (Helper) Handle

func (hlp Helper) Handle(pattern string, hdl http.Handler)

Handle will register a pattern without filtering requests by method, the request handler is responsible for differentiating

func (Helper) HandleGET

func (hlp Helper) HandleGET(pattern string, hdr http.Handler)

HandleGET registers a suppled handler with a pattern accepting GET/HEAD requests only, the semantics of how the pattern are handled depends on your router.

func (Helper) HandlePOST

func (hlp Helper) HandlePOST(pattern string, hdl http.Handler)

HandlePOST registers a suppled handler with a pattern accepting POST requests only, the semantics of how the pattern are handled depends on your router.

type ViewHandlerWithEnv

type ViewHandlerWithEnv func(*site.Env, treetop.Response, *http.Request) interface{}

ViewHandlerWithEnv is the signature of a treetop view with injected Env instance (see BindEnv)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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