server

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 11 Imported by: 1

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