app

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package app wires the process lifecycle around the HTTP API server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App runs a Server through a signal-aware serve/shutdown cycle.

func New

func New(server Server, logger *slog.Logger) *App

New creates an App around the supplied server and logger.

func (*App) Serve

func (a *App) Serve(ctx context.Context) error

Serve runs the server until ctx is canceled, then performs a graceful shutdown bounded at 30 seconds. It returns nil on a clean stop and the server's error otherwise.

type Server

type Server interface {
	// Start begins serving and blocks until the server stops.
	Start(context.Context) error
	// Shutdown gracefully stops the server, honoring the context
	// deadline.
	Shutdown(context.Context) error
}

Server is the lifecycle contract the app runs: start serving until the context ends, then shut down gracefully. Satisfied by [api.Server]; defined here so the lifecycle wiring does not depend on the HTTP package.

Jump to

Keyboard shortcuts

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