http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	Health              *health.GRPCOpts `group:"Health" namespace:"health" env-namespace:"HEALTH"`
	Port                int              `long:"port" env:"PORT" description:"Port to serve HTTP on" default:"8080"`
	ReadTimeout         time.Duration    `long:"read-timeout" env:"READ_TIMEOUT" description:"HTTP read timeout" default:"30s"`
	WriteTimeout        time.Duration    `long:"write-timeout" env:"WRITE_TIMEOUT" description:"HTTP write timeout" default:"30s"`
	IdleTimeout         time.Duration    `long:"idle-timeout" env:"IDLE_TIMEOUT"  description:"HTTP idle timeout" default:"120s"`
	GracefulStopTimeout int              `` /* 127-byte string literal not displayed */
}

Opts holds HTTP server options.

type Server

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

Server holds the HTTP server state.

func NewServer

func NewServer(opts *Opts, name string, register func(*Server)) *Server

NewServer creates a new HTTP server.

func (*Server) GetHealthServer

func (s *Server) GetHealthServer() *health.GRPCServer

func (*Server) GracefulStop

func (s *Server) GracefulStop() error

GracefulStop gracefully stops the gateway server.

func (*Server) RegisterRoute

func (s *Server) RegisterRoute(pattern string, handler func(http.ResponseWriter, *http.Request)) error

func (*Server) Serve

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

Serve the HTTP server.

func (*Server) Stop

func (s *Server) Stop() error

Stop immediately stops the gateway server.

func (*Server) WithLogger

func (s *Server) WithLogger(logger *slog.Logger) *Server

Directories

Path Synopsis
Package mockserver provides an HTTP server that stands in for a third party in tests.
Package mockserver provides an HTTP server that stands in for a third party in tests.

Jump to

Keyboard shortcuts

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