web

package
v0.0.0-...-58815fc Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MethodDELETE is for RegisterChain func, it handles DELETE methods
	MethodDELETE method = "DELETE"

	// MethodGET is for RegisterChain func, it handles GET methods
	MethodGET method = "GET"

	// MethodHEAD is for RegisterChain func, it handles HEAD methods
	MethodHEAD method = "HEAD"

	// MethodOPTIONS is for RegisterChain func, it handles OPTIONS methods
	MethodOPTIONS method = "OPTIONS"

	// MethodPATCH is for RegisterChain func, it handles PATCH methods
	MethodPATCH method = "PATCH"

	// MethodPOST is for RegisterChain func, it handles POST methods
	MethodPOST method = "POST"

	// MethodPUT is for RegisterChain func, it handles PUT methods
	MethodPUT method = "PUT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlersChain

type HandlersChain map[method]MethodChain

HandlersChain describes a map that stores method chain info.

type Instance

type Instance struct {
	Router *fasthttprouter.Router
	// contains filtered or unexported fields
}

Instance describes a server instance

func New

func New(addr string) *Instance

New web instance

func (*Instance) ListenAndServe

func (i *Instance) ListenAndServe() error

ListenAndServe on instance address

func (*Instance) ListenAndServeGZip

func (i *Instance) ListenAndServeGZip() error

ListenAndServeGZip on instance address with default compress middleware

func (*Instance) ListenAndServeGZipLevel

func (i *Instance) ListenAndServeGZipLevel(level int) error

ListenAndServeGZipLevel on instance address with selected compress level NOTE: level should be greater or equal to 0 and lower or equal to 9

func (*Instance) RegisterChain

func (i *Instance) RegisterChain(handlersChain HandlersChain)

RegisterChain adds path handlers for specified method

type MethodChain

type MethodChain map[string]func(*fasthttp.RequestCtx)

MethodChain describes a map that stores handlers for a path

Jump to

Keyboard shortcuts

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