httprest

package
v5.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(g *Server) error

Option is a http rest server functional parameter type.

func WithHTTPAddr

func WithHTTPAddr(addr string) Option

WithHTTPAddr sets the full address ( host and port ) of the server.

func WithMiddlewares

func WithMiddlewares(mw []middleware.Middleware) Option

WithMiddlewares sets the list of middlewares to be applied on routes.

func WithRouter

func WithRouter(r *http.ServeMux) Option

WithRouter sets the internal router of the server, this is required.

func WithTimeout

func WithTimeout(duration time.Duration) Option

WithTimeout allows changing the timeout value for API calls.

type Server

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

Server serves HTTP traffic.

func New

func New(ctx context.Context, opts ...Option) (*Server, error)

New returns a new instance of the Server.

func (*Server) Start

func (g *Server) Start()

Start the http rest service.

func (*Server) Status

func (g *Server) Status() error

Status of the HTTP server. Returns an error if this service is unhealthy.

func (*Server) Stop

func (g *Server) Stop() error

Stop the HTTP server with a graceful shutdown.

Jump to

Keyboard shortcuts

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