http

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAPI

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

func NewOpenAPI

func NewOpenAPI(
	appCtx context.Context,
	log *zap.Logger,
	rdyChecker func(context.Context) error,
	lastAppVer func(context.Context) (string, error),
	cfg *config.AppSettings,
	db storage.Storage,
	pubSub pubsub.PubSub[pubsub.RequestEvent],
) *OpenAPI

func (*OpenAPI) ApiAppVersion

func (o *OpenAPI) ApiAppVersion(w http.ResponseWriter, _ *http.Request)

func (*OpenAPI) ApiAppVersionLatest

func (o *OpenAPI) ApiAppVersionLatest(w http.ResponseWriter, r *http.Request)

func (*OpenAPI) ApiSessionCheckExists

func (o *OpenAPI) ApiSessionCheckExists(w http.ResponseWriter, r *http.Request)

func (*OpenAPI) ApiSessionCreate

func (o *OpenAPI) ApiSessionCreate(w http.ResponseWriter, r *http.Request)

func (*OpenAPI) ApiSessionDelete

func (o *OpenAPI) ApiSessionDelete(w http.ResponseWriter, r *http.Request, sID sID)

func (*OpenAPI) ApiSessionDeleteAllRequests

func (o *OpenAPI) ApiSessionDeleteAllRequests(w http.ResponseWriter, r *http.Request, sID sID)

func (*OpenAPI) ApiSessionDeleteRequest

func (o *OpenAPI) ApiSessionDeleteRequest(w http.ResponseWriter, r *http.Request, sID sID, rID rID)

func (*OpenAPI) ApiSessionGet

func (o *OpenAPI) ApiSessionGet(w http.ResponseWriter, r *http.Request, sID sID)

func (*OpenAPI) ApiSessionGetRequest

func (o *OpenAPI) ApiSessionGetRequest(w http.ResponseWriter, r *http.Request, sID sID, rID rID)

func (*OpenAPI) ApiSessionListRequests

func (o *OpenAPI) ApiSessionListRequests(w http.ResponseWriter, r *http.Request, sID sID)

func (*OpenAPI) ApiSessionRequestsSubscribe

func (o *OpenAPI) ApiSessionRequestsSubscribe(w http.ResponseWriter, r *http.Request, sID sID, _ skip)

func (*OpenAPI) ApiSettings

func (o *OpenAPI) ApiSettings(w http.ResponseWriter, _ *http.Request)

func (*OpenAPI) HandleInternalError

func (o *OpenAPI) HandleInternalError(w http.ResponseWriter, _ *http.Request, err error)

HandleInternalError is a default error handler for internal server errors (e.g. query parameters binding errors, and so on).

func (*OpenAPI) HandleNotFoundError

func (o *OpenAPI) HandleNotFoundError(w http.ResponseWriter, _ *http.Request)

HandleNotFoundError is a default error handler for "404: not found" errors.

func (*OpenAPI) LivenessProbe

func (o *OpenAPI) LivenessProbe(w http.ResponseWriter, r *http.Request)

func (*OpenAPI) LivenessProbeHead

func (o *OpenAPI) LivenessProbeHead(w http.ResponseWriter, r *http.Request)

func (*OpenAPI) ReadinessProbe

func (o *OpenAPI) ReadinessProbe(w http.ResponseWriter, r *http.Request)

func (*OpenAPI) ReadinessProbeHead

func (o *OpenAPI) ReadinessProbeHead(w http.ResponseWriter, r *http.Request)

type Server

type Server struct {
	ShutdownTimeout time.Duration // Maximum amount of time to wait for the server to stop, default is 5 seconds
	// contains filtered or unexported fields
}

func NewServer

func NewServer(baseCtx context.Context, log *zap.Logger, opts ...ServerOption) *Server

func (*Server) Register

func (s *Server) Register(
	ctx context.Context,
	log *zap.Logger,
	rdyChk func(context.Context) error,
	lastAppVer func(context.Context) (string, error),
	cfg *config.AppSettings,
	db storage.Storage,
	pubSub pubsub.PubSub[pubsub.RequestEvent],
	useLiveFrontend bool,
) *Server

func (*Server) StartHTTP

func (s *Server) StartHTTP(ctx context.Context, ln net.Listener) error

StartHTTP starts the HTTP server. It listens on the provided listener and serves incoming requests. To stop the server, cancel the provided context.

It blocks until the context is canceled or the server is stopped by some error.

type ServerOption

type ServerOption func(*Server)

func WithIDLETimeout

func WithIDLETimeout(d time.Duration) ServerOption

func WithReadTimeout

func WithReadTimeout(d time.Duration) ServerOption

func WithWriteTimeout

func WithWriteTimeout(d time.Duration) ServerOption

Jump to

Keyboard shortcuts

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