server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package server wires shim's HTTP routes and owns the per-request translation flow.

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 bundles the HTTP server with its dependencies. Construct via New; run via Start; tear down via Shutdown.

func New

func New(cfg *config.Config, log *slog.Logger, a adapter.Adapter) (*Server, error)

New constructs a Server bound to the given adapter (cmd/shim/main.go builds it via buildAdapter). Adapter.Validate() runs once here — the single config gate; misconfiguration fails startup loudly rather than the first request.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the bind address the server will listen on.

func (*Server) Shutdown

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

Shutdown gracefully drains in-flight requests until ctx is done.

func (*Server) Start

func (s *Server) Start() error

Start blocks serving HTTP until the server is shut down. Listens first, then logs the actually-bound addr (matters when PORT=0 picks an ephemeral port — thesis-1: don't lie about what we did).

Jump to

Keyboard shortcuts

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