handler

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContentHandler added in v0.3.3

func NewContentHandler(cfg tree.Map, _ logger.Logger) (fasthttp.RequestHandler, error)

func NewExpvarHandler added in v0.3.3

func NewExpvarHandler(cfg tree.Map, l logger.Logger) (fasthttp.RequestHandler, error)

NewExpvarHandler returns a ExpvarHandler that dumps json representation of expvars to http response. Refer to https://github.com/valyala/fasthttp/tree/master/expvarhandler

func NewFS added in v0.1.0

func NewFS(cfg tree.Map) (*fasthttp.FS, error)

func NewFSHandler

func NewFSHandler(cfg tree.Map, l logger.Logger) (fasthttp.RequestHandler, error)

func NewHandler

func NewHandler(cfg tree.Map, l logger.Logger) (fasthttp.RequestHandler, error)

func NewProxyHandler

func NewProxyHandler(cfg tree.Map, l logger.Logger) (fasthttp.RequestHandler, error)

func RegisterNewHandlerFunc

func RegisterNewHandlerFunc(t string, fn NewHandlerFunc)

Types

type Content added in v0.3.3

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

func NewContent added in v0.3.3

func NewContent(cfg tree.Map) *Content

func (*Content) Handle added in v0.3.3

func (h *Content) Handle(ctx *fasthttp.RequestCtx)

type ErrorPages

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

func NewErrorPages

func NewErrorPages(root string, cfg map[string]string) *ErrorPages

func (*ErrorPages) Handle

func (p *ErrorPages) Handle(ctx *fasthttp.RequestCtx)

type NewHandlerFunc

type NewHandlerFunc func(cfg tree.Map, l logger.Logger) (fasthttp.RequestHandler, error)

type ProxyHandler

type ProxyHandler struct {
	URL string
}

type ServerHandler added in v0.3.3

type ServerHandler interface {
	// Config returns the config.Config.Server.
	Config() tree.Map
	// Logger returns a logger.
	Logger() logger.Logger
	// Handle handles the provided request.
	Handle(ctx *fasthttp.RequestCtx)
	// HandleError implements fasthttp.Server.ErrorHandler.
	HandleError(ctx *fasthttp.RequestCtx, err error)
	// Close closes the server.
	Close() error
}

ServerHandler is an interface that defines the methods to handle a server.

func NewServerHandler added in v0.3.3

func NewServerHandler(cfgs []config.Config) (ServerHandler, error)

NewServerHandler creates a new ServerHandler by the provided cfgs.

Jump to

Keyboard shortcuts

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