server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package server provides a basic HTTP server wrapper

Package server provides a basic HTTP server wrapper

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

Group encapsulates managing multiple Server instances

func NewGroup

func NewGroup(ctx context.Context, conf config.ServerConfig) *Group

NewGroup creares a new server group.

func (*Group) GoListenAndServe

func (g *Group) GoListenAndServe(name, port string, handler http.Handler)

GoListenAndServe constructs a NewServer and adds it to the Group. Two goroutines are started. One for the http listener and one to initiate a graceful shutdown. This method blocks on adding the go routines to maintain startup order of each listener.

func (*Group) Wait

func (g *Group) Wait() error

Wait waits for all servers to complete before returning

type Server

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

Server has generic functionality for service: it starts the service and performs basic checks

func NewServer

func NewServer(name, port string, handler http.Handler, conf config.ServerConfig) (Server, error)

NewServer initializes new service. Configuration is pulled from viper configuration.

func (Server) ListenAndServe

func (s Server) ListenAndServe() (err error)

ListenAndServe starts the server

func (Server) Shutdown

func (s Server) Shutdown()

Shutdown server gracefully

Jump to

Keyboard shortcuts

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