server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotStarted = errors.New("server not running")

ErrNotRunning is an error returned by (*Server).Shutdown() if the server was not started yet.

Functions

This section is empty.

Types

type Server

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

Server is a type representing an HTTP server.

func New

func New(host string, port int) *Server

New returns an unstarted *Server instance that serves connections on provided host:port.

func (*Server) Run

func (srv *Server) Run(h http.Handler) error

Run starts the server and spawns a goroutine that accepts incoming connections and handles them using http.Handler.

func (*Server) Shutdown

func (srv *Server) Shutdown() error

Shutdown terminates running server.

Jump to

Keyboard shortcuts

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