server

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package server provides a http server with request timeout and grateful shutdown.

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 contains a http server.

func New

func New(name, port string, handler http.Handler) *Server

New returns a server, and start it.

func (*Server) ServeUnblock

func (s *Server) ServeUnblock()

ServeUnblock serves the http server inside a goroutine so that it doesn't block. Will crash if the server failed to bind the port.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown the server, doesn't block if no connections, but will otherwise wait until the timeout deadline.

Jump to

Keyboard shortcuts

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