server

package
v0.0.0-...-85caf32 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadRequestBody

func ReadRequestBody(
	w http.ResponseWriter,
	r *http.Request,
	bodyObj interface{},
) bool

func ServeRequest

func ServeRequest(req InternalRequest, logger *zap.Logger)

func WriteAPIResponse

func WriteAPIResponse(
	w http.ResponseWriter,
	statusCode int,
	res interface{},
)

Types

type Endpoints

type Endpoints interface {
	Register(r chi.Router)
}

type InternalRequest

type InternalRequest struct {
	W             http.ResponseWriter
	R             *http.Request
	ReqBodyObj    interface{}
	EndpointLogic func() (interface{}, error)
	SuccessCode   int
}

type Server

type Server interface {
	ListenAndServe()
}

func NewServer

func NewServer(endpoints []Endpoints, config *ServerConfig, logger *zap.Logger) Server

type ServerConfig

type ServerConfig struct {
	TLSCertPath string
	TLSKeyPath  string
	Port        int
	TLSEnabled  bool
}

Jump to

Keyboard shortcuts

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