router

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourcePath

func ResourcePath(r *resources.Resource, ext string) string

Types

type ErrorPageComponent

type ErrorPageComponent = func(message string) templ.Component

type Mod

type Mod interface {
	// contains filtered or unexported methods
}

func RoutePage

func RoutePage[M any](handler func(r *Request[M]) Response) Mod

func ServeDir

func ServeDir(prefix string, root http.FileSystem) Mod

func ServeDirPath

func ServeDirPath(prefix string, localPath string) Mod

func ServeFallback

func ServeFallback(handler http.Handler) Mod

func ServeFile

func ServeFile(path string, localPath string) Mod

func SetBuildProfiles

func SetBuildProfiles(profiles resources.BuildProfiles) Mod

func SetCSP

func SetCSP(csp *common.CSP) Mod

func SetErrorPage

func SetErrorPage(page ErrorPageComponent) Mod

func SetGoroutineLimit

func SetGoroutineLimit(n int) Mod

func SetSessionHooks

func SetSessionHooks(create func(id string), delete func(id string)) Mod

func SetSystemConf

func SetSystemConf(conf common.SystemConf) Mod

type PageResponse

type PageResponse[M any] struct {
	Page    instance.Page[M]
	Status  int
	Model   *M
	Adapter *path.Adapter[M]
}

type RedirectResponse

type RedirectResponse struct {
	Status int
	Model  any
}

type Request

type Request[M any] struct {
	Model   *M
	W       http.ResponseWriter
	R       *http.Request
	Adapter *path.Adapter[M]
}

type RerouteResponse

type RerouteResponse struct {
	Detached bool
	Model    any
}

type Response

type Response interface {
	// contains filtered or unexported methods
}

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) Adapters

func (rr *Router) Adapters() map[string]path.AnyAdapter

func (*Router) CSP

func (rr *Router) CSP() *common.CSP

func (*Router) Conf

func (rr *Router) Conf() *common.SystemConf

func (*Router) Gzip

func (rr *Router) Gzip() bool

func (*Router) ImportRegistry

func (rr *Router) ImportRegistry() *resources.Registry

func (*Router) RemoveSession

func (rr *Router) RemoveSession(id string)

func (*Router) ServeHTTP

func (rr *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Router) Spawner

func (rr *Router) Spawner(op shredder.OnPanic) *shredder.Spawner

func (*Router) Use

func (rr *Router) Use(mods ...Mod)

type StaticPage

type StaticPage struct {
	Status  int
	Content templ.Component
}

Jump to

Keyboard shortcuts

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