| Context keys, request IDs, user metadata | references/context-propagation.md | | slog setup, logging middleware, child loggers | references/structured-logging.md | | AppHandler pattern, domain errors, recovery | references/error-handling-middleware.md |
All middleware follows the standard func(http.Handler) http.Handler pattern. This is the composable building block for cross-cutting concerns in Go HTTP servers.
Use context.WithValue for request-scoped data that crosses API boundaries (request IDs, authenticated users, tenant IDs). Always use typed keys to avoid collisions.
Идиоматические шаблоны промежуточного программного обеспечения Go HTTP с распространением контекста, структурированным журналированием через slog, централизованной обработкой ошибок и аварийным восстановлением. Используйте при написании промежуточного программного обеспечения, добавлении трассировки запросов или реализации сквозных задач. Источник: existential-birds/beagle.