devserver

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package devserver implements `anetos dev`: it watches the project, regenerates code (templ, anetos gen), rebuilds and restarts the app on every change, and serves it through a reverse proxy on a stable address that reloads open pages when the new version is up, or shows the build error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, o Options) error

Run serves the app with live reload until ctx is canceled.

Types

type Options

type Options struct {
	Dir      string        // project root (with go.mod)
	Addr     string        // proxy address, e.g. ":8080"
	Args     []string      // app arguments; default "run"
	Poll     time.Duration // how often to look for changes; default 300ms
	Out      io.Writer     // progress and the app's output
	OnListen func(addr string)
	// Hosts are the host names (without port) browsers may use besides
	// localhost, *.localhost and IP addresses, such as APP_URL's
	// ("blog.test"). Others get 403: a page on another site can't reach
	// the dev server by pointing its own name at 127.0.0.1 (DNS
	// rebinding).
	Hosts []string
}

Options configures Run.

Jump to

Keyboard shortcuts

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