Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package server is Console's HTTP layer. It exposes a JSON API over the flag and status engines and a small server-rendered dashboard (htmx) on top of the same App. It owns no business logic: every handler is a thin adapter that decodes a request, calls an engine, and encodes the result.

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 wires an App to an http.ServeMux and the dashboard templates. Construct it with New, register routes with Routes, and obtain the wrapped handler with Handler.

func New

func New(a *app.App) *Server

New builds a Server over a. It parses the embedded dashboard templates and registers all routes; the returned Server is ready to serve.

func (*Server) Handler

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

Handler returns the mux wrapped with logging + panic-recovery middleware.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

ListenAndServe serves the dashboard and API on addr until the process exits.

Console serves plain HTTP by design: it binds loopback by default and expects TLS to be terminated by a reverse proxy or ingress when exposed to a network (see SECURITY.md). It never terminates TLS itself, so the semgrep use-tls rule is suppressed here intentionally.

func (*Server) Routes

func (s *Server) Routes()

Routes registers every API and UI route on the mux. It is safe to call once during construction.

Jump to

Keyboard shortcuts

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