server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package server serves generated Obsite output directories for local preview.

Index

Constants

View Source
const DefaultPort = 8080

DefaultPort is the default local preview port for obsite serve.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server serves a generated Obsite output directory over HTTP.

func New

func New(outputPath string, port int) (*Server, error)

New validates the generated output directory and constructs a preview server.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the listen address for the preview server.

func (*Server) EnableLiveReload

func (s *Server) EnableLiveReload()

EnableLiveReload turns on the SSE endpoint and HTML script injection used by watch mode.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the preview server.

func (*Server) NotifyReload

func (s *Server) NotifyReload()

NotifyReload broadcasts a livereload event to connected preview clients.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles clean-URL fallbacks before delegating to the underlying file server.

Jump to

Keyboard shortcuts

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