www

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package www serves the Web application.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerCSRFKeyRequired         = errors.New("server: csrf key required")
	ErrServerMetricsPrefixRequired   = errors.New("server: metrics prefix required")
	ErrServerMetricsRegistryRequired = errors.New("server: metrics registry required")
	ErrServerPublicURLRequired       = errors.New("server: public url required")

	ErrServerBookmarkServiceRequired          = errors.New("server: bookmark service required")
	ErrServerBookmarkExportingServiceRequired = errors.New("server: bookmark exporting service required")
	ErrServerBookmarkImportingServiceRequired = errors.New("server: bookmark importing service required")
	ErrServerBookmarkQueryingServiceRequired  = errors.New("server: bookmark querying service required")

	ErrServerFeedServiceRequired          = errors.New("server: feed service required")
	ErrServerFeedExportingServiceRequired = errors.New("server: feed exporting service required")
	ErrServerFeedImportingServiceRequired = errors.New("server: feed importing service required")
	ErrServerFeedQueryingServiceRequired  = errors.New("server: feed querying service required")

	ErrServerSessionServiceRequired = errors.New("server: session service required")
	ErrServerUserServiceRequired    = errors.New("server: user service required")
)

Functions

This section is empty.

Types

type OptionFunc added in v0.5.0

type OptionFunc func(*Server) error

OptionFunc represents a function that configures a set of options for a Server.

func WithBookmarkServices

func WithBookmarkServices(
	bookmarkService *bookmark.Service,
	exportingService *bookmarkexporting.Service,
	importingService *bookmarkimporting.Service,
	queryingService *bookmarkquerying.Service,
) OptionFunc

WithBookmarkServices sets the bookmark management services.

func WithCSRFKey

func WithCSRFKey(csrfKey string) OptionFunc

WithCSRFKey sets the CSRF key used to secure HTML forms.

func WithFeedServices

func WithFeedServices(
	feedService *feed.Service,
	feedExportingService *feedexporting.Service,
	feedImportingService *feedimporting.Service,
	feedQueryingService *feedquerying.Service,
) OptionFunc

WithFeedServices sets the feed management services.

func WithMetricsRegistry

func WithMetricsRegistry(prefix string, registry *prometheus.Registry) OptionFunc

WithMetricsRegistry sets the Prometheus metrics registry used to expose application metrics.

func WithPublicURL

func WithPublicURL(publicURL *url.URL) OptionFunc

WithPublicURL sets the public URL the application is accessible at.

This URL is used to generate absolute URLs for permalinks and feeds.

func WithSessionService

func WithSessionService(sessionService *session.Service) OptionFunc

WithSessionService sets the user session management service.

func WithUserService

func WithUserService(userService *user.Service) OptionFunc

WithUserService sets the user management service.

type Server

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

Server represents the Web service.

func NewServer

func NewServer(optionFuncs ...OptionFunc) (*Server, error)

NewServer initializes and returns a new Server.

func (*Server) ServeHTTP

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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