server

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

templ: version: v0.3.833

Index

Constants

View Source
const (
	HeaderHXRequest       = "HX-Request"
	HeaderTemplSkipModify = "templ-skip-modify"

	// PathProxyEvents defines the path for templier proxy websocket events endpoint.
	// This path is very unlikely to collide with any path used by the app server.
	PathProxyEvents = "/__templier/events"

	ReverseProxyRetries         = 20
	ReverseProxyInitialDelay    = 100 * time.Millisecond
	ReverseProxyBackoffExponent = 1.5
)

Variables

This section is empty.

Functions

func MustRenderJSInjection added in v0.10.6

func MustRenderJSInjection(ctx context.Context, printJSDebugLogs bool) []byte

func RenderErrpage added in v0.10.6

func RenderErrpage(
	ctx context.Context, w io.Writer,
	title string, content []Report,
	printJSDebugLogs bool,
) error

func WriteWithInjection added in v0.10.6

func WriteWithInjection(
	w io.Writer, body []byte, injection []byte,
) error

WriteWithInjection writes to w the body with the injection either at the end of the head or at the end of the body. If neither the head nor the body closing tags are the injection is written to w before body.

Types

type Config

type Config struct {
	PrintJSDebugLogs bool
	AppHost          *url.URL
	ProxyTimeout     time.Duration
}

type Report added in v0.4.0

type Report struct{ Subject, Body string }

type Server

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

func New

func New(
	httpClient *http.Client,
	stateTracker *statetrack.Tracker,
	reload *broadcaster.SignalBroadcaster,
	config *config.Config,
) *Server

func (*Server) ServeHTTP

func (s *Server) 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