http

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package http provides HTTP server implementation and request handlers.

Package http provides HTTP server implementation and request handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthHandler

func HealthHandler() http.Handler

HealthHandler returns a simple health check handler

func ReadinessHandler

func ReadinessHandler(ctx context.Context) http.Handler

ReadinessHandler returns a readiness check handler

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware defines a function to wrap http.Handler

func ChainMiddleware

func ChainMiddleware(middlewares ...Middleware) Middleware

ChainMiddleware chains multiple middlewares

func LoggingMiddleware

func LoggingMiddleware(logger *slog.Logger) Middleware

LoggingMiddleware logs HTTP requests

func RecoveryMiddleware

func RecoveryMiddleware(logger *slog.Logger) Middleware

RecoveryMiddleware recovers from panics

type Server

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

Server represents the HTTP server

func NewServer

func NewServer(
	host string,
	port int,
	logger *slog.Logger,
	userUseCaseInstance userUsecase.UseCase,
) *Server

NewServer creates a new HTTP server

func (*Server) Shutdown

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

Shutdown gracefully shuts down the HTTP server

func (*Server) Start

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

Start starts the HTTP server

Jump to

Keyboard shortcuts

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