Documentation
¶
Overview ¶
Package server provides the HTTP server for the WikiMD web application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the HTTP server and configuration for serving markdown content over HTTP. It provides a RESTful API for reading, creating, updating, and deleting markdown documents, along with a web interface for browsing the wiki.
func New ¶
func New(cfg config.Config, logger *slog.Logger, contentSvc *content.Service, searchSvc *search.Service) (*Server, error)
New constructs a new Server with the provided configuration and services. It initializes the HTTP server, registers all routes and middleware, and prepares the server for starting via the Start method. Returns an error if template loading or exporter initialization fails.
func (*Server) Shutdown ¶
Shutdown gracefully stops the server with the provided context timeout. It waits for all active connections to close or the context to be canceled. Returns an error if the shutdown process fails or times out.
func (*Server) Start ¶
Start runs the HTTP server and optionally opens the browser. The server will listen on the configured port (or allocate a dynamic port if cfg.Port is 0). It supports graceful shutdown when the provided context is canceled. The method blocks until the server stops or an error occurs.