daemon

package
v0.0.0-...-300ac43 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSON

func WriteJSON(w http.ResponseWriter, v interface{}) error

Types

type CancelCloser

type CancelCloser struct {
	Cancel func()
}

func (*CancelCloser) Close

func (c *CancelCloser) Close() error

type Daemon

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

func New

func New(service, addr string, logger *zerolog.Logger, routers ...Router) (*Daemon, error)

func (*Daemon) Close

func (d *Daemon) Close() error

func (*Daemon) Serve

func (d *Daemon) Serve(ctx context.Context) error

type Handler

type Handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error

type Route

type Route interface {
	Method() string
	Path() string
	Handler() Handler
}

func NewDeleteRoute

func NewDeleteRoute(path string, handler Handler) Route

func NewGetRoute

func NewGetRoute(path string, handler Handler) Route

func NewHeadRoute

func NewHeadRoute(path string, handler Handler) Route

func NewOptionsRoute

func NewOptionsRoute(path string, handler Handler) Route

func NewPostRoute

func NewPostRoute(path string, handler Handler) Route

func NewPutRoute

func NewPutRoute(path string, handler Handler) Route

func NewRoute

func NewRoute(method, path string, handler Handler) Route

type Router

type Router interface {
	Routes() []Route
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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