handlers

package
v0.0.0-...-026be54 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateNotFound = errors.New("template not found")

ErrTemplateNotFound provides a static error that can be wrapped when template discovery fails.

Functions

func DefaultMaintenanceHandler

func DefaultMaintenanceHandler() http.HandlerFunc

func GetTemplate

func GetTemplate(ctx context.Context, name string) (*template.Template, error)

func NewTemplateWriterService

func NewTemplateWriterService() *templateWriterService

func StaticHandler

func StaticHandler(dir fs.FS) http.HandlerFunc

StaticHandler wraps a http.FileServer with some extra handling that allows us to trap errors of various types (mainly 404 not found) and allow us to return nicer error pages.

func StaticMaintenanceHandler

func StaticMaintenanceHandler(PageTitle string, Template string) http.HandlerFunc

Types

type Template

type Template interface {
	ExecuteTemplate(io.Writer, string, interface{}) error
}

type TemplateContextKey

type TemplateContextKey struct{}

type Templates

type Templates interface {
	Get(name string) (*template.Template, error)
}

type UserContextKey

type UserContextKey struct{}

Jump to

Keyboard shortcuts

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