server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware(next http.Handler) http.Handler

CORS middleware for development

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware logs HTTP requests

func ResponseFormatMiddleware

func ResponseFormatMiddleware(next http.Handler) http.Handler

ResponseFormatMiddleware detects and sets the response format

Types

type ResponseFormat

type ResponseFormat string

ResponseFormat represents the desired response format

const (
	FormatHTMX ResponseFormat = "htmx"
	FormatJSON ResponseFormat = "json"
	FormatPush ResponseFormat = "push"
)

func GetFormat

func GetFormat(ctx context.Context) ResponseFormat

GetFormat retrieves the response format from context

type Server

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

Server is the main application server

func New

func New(cfg *config.Config, webFS fs.FS) (*Server, error)

New creates a new Server instance

func (*Server) BroadcastTrigger

func (s *Server) BroadcastTrigger(triggerType, title, message string, data interface{}) error

BroadcastTrigger sends a trigger to all connected clients

func (*Server) Hub

func (s *Server) Hub() *ws.Hub

Hub returns the WebSocket hub

func (*Server) NudgeScheduler added in v0.4.0

func (s *Server) NudgeScheduler() *nudge.Scheduler

NudgeScheduler returns the nudge scheduler for activity tracking

func (*Server) Router

func (s *Server) Router() *chi.Mux

Router returns the HTTP router

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server

Jump to

Keyboard shortcuts

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