webservice

package
v0.0.0-...-ed2fce9 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is a wrapper for http.Server.

func NewServer

func NewServer(
	serviceIdentifier string,
	config ServerConfig,
	handler http.Handler,
) (*Server, error)

func (*Server) Serve

func (srv *Server) Serve(_ context.Context) error

func (*Server) ServiceInfo

func (srv *Server) ServiceInfo() service.Info

func (*Server) ServiceStatus

func (srv *Server) ServiceStatus() service.Status

func (*Server) ShutdownService

func (srv *Server) ShutdownService(ctx context.Context) error

type ServerConfig

type ServerConfig struct {
	ServePort int `env:"SERVE_PORT"`

	// ServiceInfo is used to override server's service info.
	ServiceInfo *service.Info `env:"-"`

	// Logger is used to pass the logger to the server instance.
	Logger *slog.Logger `env:"-"`
}

Jump to

Keyboard shortcuts

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