server

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenAddress     string        `json:"listen_address" yaml:"listen_address"`
	WriteTimeout      time.Duration `json:"write_timeout" yaml:"write_timeout"`
	ReadTimeout       time.Duration `json:"read_timeout" yaml:"read_timeout"`
	ReadHeaderTimeout time.Duration `json:"read_header_timeout" yaml:"read_header_timeout"`
}

Config for replicant server

type Handler

type Handler = httprouter.Handle

Handler is a http handler

type Params

type Params = httprouter.Params

Params from the URL

type Server

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

Server is an replicant manager and api server

func New

func New(config Config, m *manager.Manager, r *httprouter.Router) (server *Server, err error)

New creates a new replicant server

func (*Server) AddHandler

func (s *Server) AddHandler(method, path string, handler Handler)

AddHandler adds a handler for the given method and path

func (*Server) AddServerHandler

func (s *Server) AddServerHandler(method, path string, handler ServerHandler)

AddServerHandler adds a handler for the given method and path

func (*Server) Close

func (s *Server) Close(ctx context.Context) (err error)

Close this server

func (*Server) Manager

func (s *Server) Manager() (m *manager.Manager)

Manager returns this server replicant manager

func (*Server) Router

func (s *Server) Router() (r *httprouter.Router)

Router returns this server http router

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements the http.Handler interface for testing and handler usage

func (*Server) Start

func (s *Server) Start() (err error)

Start serving

type ServerHandler added in v0.0.2

type ServerHandler func(*Server) httprouter.Handle

ServerHandler is handler that has access to the server

Jump to

Keyboard shortcuts

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