server

package
v0.0.100 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureFrontendDevServer added in v0.0.99

func EnsureFrontendDevServer(ctx context.Context) (chan struct{}, error)

func FindAvailablePort added in v0.0.96

func FindAvailablePort(startPort int, maxAttempts int) (int, error)

FindAvailablePort finds a port starting from startPort

func FormatTemplateHtml added in v0.0.96

func FormatTemplateHtml(opts FormatOptions) (string, error)

FormatTemplateHtml formats the template HTML with the given options

func Init

func Init(fs embed.FS, tmpl string)

func ProxyDev

func ProxyDev(mux *http.ServeMux) error

func RegisterAPI

func RegisterAPI(mux *http.ServeMux) error

func Serve

func Serve(port int, dev bool) error

func ServeComponent added in v0.0.96

func ServeComponent(port int, opts ServeOptions) error

func Static

func Static(mux *http.ServeMux, opts StaticOptions) error

Types

type FormatOptions added in v0.0.96

type FormatOptions struct {
	Title          string // __TITLE__ placeholder
	Render         string // __RENDER__ placeholder (default: "renderComponent")
	Component      string // __COMPONENT__ placeholder (mandatory)
	ComponentProps string // __COMPONENT_PROPS__ placeholder (default: "{}")
}

FormatOptions contains the options for formatting the template HTML

type ServeOptions added in v0.0.96

type ServeOptions struct {
	Static         StaticOptions
	NoOpenBrowser  bool
	OpenBrowserUrl func(port int, url string) string
	Route          func(mux *http.ServeMux) error // Optional custom route registration
	Dev            bool
}

type StaticOptions added in v0.0.96

type StaticOptions struct {
	IndexHtml string // Custom HTML content to serve instead of embedded index.html
}

Jump to

Keyboard shortcuts

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