htxtd

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 11 Imported by: 0

README

htxtd

htxtd is a static website server.

htxtd --bind 0.0.0.0 --port 8080 builds/development

The directory argument is required and is resolved from the current working directory. The default bind address is localhost; the default port is 8080.

The htxtd.Server package API can also provide server-owned browser live reload. Set LiveReload, call Reload after a successful external rebuild, and the server injects its client into full HTML responses without changing the files on disk.

Documentation

Overview

Package htxtd serves static HyperTexting website output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsoluteDirectory

func AbsoluteDirectory(workingDirectory, directory string) (string, error)

AbsoluteDirectory resolves a directory from a working directory.

Types

type Server

type Server struct {
	Directory  string
	Bind       string
	Port       int
	LiveReload bool
	LogWriter  io.Writer
	// contains filtered or unexported fields
}

Server serves a static website directory over HTTP.

func (*Server) Address

func (server *Server) Address() string

Address returns the TCP address on which the server listens.

func (*Server) Handler

func (server *Server) Handler() http.Handler

Handler returns the configured static-file handler.

func (*Server) Listen

func (server *Server) Listen() (net.Listener, error)

Listen validates the server and opens its TCP listener.

func (*Server) Reload

func (server *Server) Reload()

Reload notifies connected live-reload clients after a successful build.

func (*Server) Run

func (server *Server) Run(ctx context.Context) error

Run validates the server and serves until the context is canceled.

func (*Server) Serve

func (server *Server) Serve(ctx context.Context, listener net.Listener) error

Serve serves on a listener returned by Listen until the context is canceled.

func (*Server) Validate

func (server *Server) Validate() error

Validate verifies that the server can serve a static website directory.

Directories

Path Synopsis
Package cli composes htxtd's static website server command.
Package cli composes htxtd's static website server command.
cmd
htxtd command
Command htxtd serves static HyperTexting websites.
Command htxtd serves static HyperTexting websites.

Jump to

Keyboard shortcuts

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