app

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package app provides the application bootstrap, dependency injection container, HTTP server lifecycle, and graceful shutdown.

The App type is the central wiring point. It owns the HTTP server, router, health handler, and logger. Shutdown hooks registered via OnStop are called in order during graceful shutdown, giving each component a chance to flush and release resources before the process exits.

Graceful shutdown follows the pattern described in The Go Programming Language (Donovan & Kernighan): listen for SIGINT/SIGTERM, then call server.Shutdown with a context deadline so in-flight requests can complete.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config *config.Config
	Logger *logger.Logger
	Router *router.Router
	Health *health.Handler
	// contains filtered or unexported fields
}

App is the central application container.

func New

func New(cfg *config.Config) *App

New creates an App with sensible defaults.

func (*App) OnStop

func (a *App) OnStop(fn func(context.Context) error)

OnStop registers a shutdown hook called during graceful shutdown.

func (*App) Run

func (a *App) Run() error

Run starts the HTTP server and blocks until a signal is received.

Jump to

Keyboard shortcuts

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