httpserver

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package httpserver composes application and management HTTP handlers and serves them independently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManagement added in v0.4.0

func NewManagement(routes ManagementRoutes) http.Handler

NewManagement constructs the standard operational route handler.

func Run

func Run(
	ctx context.Context,
	applicationAddress string,
	managementAddress string,
	handlers Handlers,
	appLogger *slog.Logger,
	mgmtLogger *slog.Logger,
) error

Run serves application and optionally management traffic until shutdown or a listener fails.

Types

type Config

type Config struct {
	// Application serves application and API traffic.
	Application http.Handler
	// Management serves operational traffic such as health, readiness, and metrics.
	Management http.Handler
	// RoutePrefix mounts public routes beneath the deployment prefix; management routes remain unprefixed.
	RoutePrefix string
}

Config supplies public and operational routes and the application deployment prefix.

type Handlers

type Handlers struct {
	// Application is served on the public listener.
	Application http.Handler
	// Management is served on the operational listener when configured.
	Management http.Handler
}

Handlers contains the assembled application and management handlers.

func New

func New(config Config) Handlers

New constructs independent HTTP handlers; only application routes use the route prefix.

type ManagementRoutes added in v0.4.0

type ManagementRoutes struct {
	// Health serves process liveness checks at /healthz.
	Health http.Handler
	// Readiness serves dependency readiness checks at /readyz.
	Readiness http.Handler
	// Metrics optionally serves metrics exposition at /metrics.
	Metrics http.Handler
}

ManagementRoutes contains the operational endpoints served outside application middleware.

Jump to

Keyboard shortcuts

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