rest

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogServerMiddleware

func LogServerMiddleware(logger *zap.Logger) middleware

func MetricsServerMiddleware

func MetricsServerMiddleware(next http.Handler) http.Handler

func NewErrStatus

func NewErrStatus(code int, msg string) error

func ReturnFailureResponse

func ReturnFailureResponse(w http.ResponseWriter, err error)

func ReturnSuccessResponse

func ReturnSuccessResponse(w http.ResponseWriter, resp interface{})

Types

type Option

type Option func(*Server)

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithMetrics

func WithMetrics(registerer metrics.Registerer) Option

func WithPort

func WithPort(port int) Option

func WithService

func WithService(service Service) Option

type Server

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

func NewServer

func NewServer(certPath, keyPath string, opt ...Option) *Server

func (*Server) Run

func (s *Server) Run()

func (*Server) Stop

func (s *Server) Stop(timeout time.Duration)

type Service

type Service interface {
	Register(mux *http.ServeMux)
}

Jump to

Keyboard shortcuts

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