gohandle

package module
v0.0.0-...-ac26e8f Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const LOCAL_ENV_VAR = "GOHANDLE_LOCAL"

Variables

This section is empty.

Functions

func Run

func Run(handlers []Handler)

Types

type Function

type Function interface {
	Name() string
	Func() any
}

func Mod

func Mod() Function

func NewFunction

func NewFunction(name string, f any) Function

func Plus

func Plus() Function

type Handler

type Handler interface {
	http.Handler
	GetPattern() string
}

type RedirectHandler

type RedirectHandler struct {
	Pattern string
	Dest    string
}

func (*RedirectHandler) GetPattern

func (rh *RedirectHandler) GetPattern() string

func (*RedirectHandler) ServeHTTP

func (rh *RedirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Request

type Request struct{}

type TemplateFile

type TemplateFile string

func Join

func Join(ss ...string) TemplateFile

type TemplateFiles

type TemplateFiles []TemplateFile

type TemplateHandler

type TemplateHandler struct {
	Pattern      string
	Template     TemplateFile
	Templates    TemplateFiles
	Functions    []Function
	GenerateData func(r *http.Request) (any, error)
}

func (*TemplateHandler) GetPattern

func (sh *TemplateHandler) GetPattern() string

func (*TemplateHandler) ServeHTTP

func (sh *TemplateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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