server

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: Apache-2.0 Imports: 11 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeResponse

func EncodeResponse(rw http.ResponseWriter, statusCode int, data interface{}) error

EncodeResponse encodes response in json.

func HandleErrorResponse

func HandleErrorResponse(w http.ResponseWriter, err error)

HandleErrorResponse handles err from daemon side and constructs response for client side.

Types

type Handler

type Handler func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error

Handler is the http request handler.

type HandlerSpec

type HandlerSpec struct {
	Method      string
	Path        string
	HandlerFunc Handler
}

HandlerSpec is used to describe a HTTP API.

func NewHandlerSpec

func NewHandlerSpec(method, path string, handler Handler) *HandlerSpec

NewHandlerSpec constructs a brand new HandlerSpec.

type Server

type Server struct {
	Config *config.Config
}

Server is server instance.

func New

func New(cfg *config.Config) (*Server, error)

New creates a brand new server instance.

func (*Server) Start

func (s *Server) Start() error

Start runs

Jump to

Keyboard shortcuts

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