server

package
v0.0.0-...-bd94320 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 6 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 http server. Can be started with Start method. Gracefully stops when context is canceled. Must be initialized with New function.

func New

func New(settings Settings) *Server

New creates new Server instance. It takes Settings as argument and returns pointer to Server. All fields of Settings are required and cant be nil.

func (*Server) Start

func (a *Server) Start(ctx context.Context) error

Start starts the server and blocks until context is canceled. It returns error if server cant be started. Server is gracefully stopped when context is canceled. If error occurs on start, shutdown is skipped.

type Settings

type Settings struct {
	Addr string
	Port string

	Handler http.Handler

	ShutdownMaxTime time.Duration
}

Settings used to create Server. Settings must be provided to New function. All fields are required and cant be nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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