orbit

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleMode

type BundleMode int32
const (
	DevBundleMode  BundleMode = 0
	ProdBundleMode BundleMode = 1
)
var CurrentDevMode BundleMode

type DefaultPage

type DefaultPage interface {
	Handle(*Request)
}

DefaultPage defines the standard behavior for a orbit page handler

type DocumentRenderer added in v0.7.0

type DocumentRenderer struct {
	// contains filtered or unexported fields
}

type MuxHandler

type MuxHandler interface {
	HandleFunc(string, func(http.ResponseWriter, *http.Request))
	Handle(string, http.Handler)
	ServeHTTP(http.ResponseWriter, *http.Request)
}

muxHandle is used to inject the base mux handler behavior

type PageRender

type PageRender string

type Request

type Request struct {
	RenderPage  func(page PageRender, data interface{})
	RenderPages func(data interface{}, pages ...PageRender)
	Request     *http.Request
	Response    http.ResponseWriter
	Slugs       map[string]string
}

Request is the standard request payload for the orbit page handler this is just a fancy wrapper around the http request & response that will also assist the rendering of bundled pages & incoming path slugs

type Serve

type Serve struct {
	// contains filtered or unexported fields
}

func New

func New() (*Serve, error)

func (*Serve) HandleFunc

func (s *Serve) HandleFunc(path string, handler func(c *Request))

HandleFunc attaches a handler to the specified pattern, this handler will be ran upon a match of the request path during an incoming http request.

func (*Serve) HandlePage

func (s *Serve) HandlePage(path string, dp DefaultPage)

HandlePage attaches an orbit page to the specified pattern, this handler will be ran upon a match of the request path during an incoming http request

func (*Serve) Serve

func (s *Serve) Serve() MuxHandler

Serve returns the mux server

Jump to

Keyboard shortcuts

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