http

package
v0.0.0-...-88eb885 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMethodNotAllowed :
	ErrMethodNotAllowed = errors.New(errMethodNotAllowed)

	// ErraqueductServerError :
	ErraqueductServerError = errors.New(erraqueductServerError)

	// ErrBadRequest :
	ErrBadRequest = errors.New(errBadRequest)

	// ErrNotAuthorized :
	ErrNotAuthorized = errors.New(errNotAuthorized)

	// ErrNotImplemented :
	ErrNotImplemented = errors.New(errNotImplemented)
)

Functions

This section is empty.

Types

type BaseHandlerAdapter

type BaseHandlerAdapter struct {
	httprouter.Router
}

BaseHandlerAdapter :

func (*BaseHandlerAdapter) RegisterHandlerFunc

func (a *BaseHandlerAdapter) RegisterHandlerFunc(method string, path string, handler HandlerFunc, middleware ...Middleware)

RegisterHandlerFunc :

type Error

type Error interface {
	error
	Code() int
}

Error :

func NewError

func NewError(code int, base error, extra ...interface{}) Error

NewError :

type HandlerAdapter

type HandlerAdapter interface {
	http.Handler
}

HandlerAdapter :

type HandlerFunc

type HandlerFunc func(Response, *Request) (interface{}, error)

HandlerFunc is a custom HTTP handler function that returns a struct and an error that will be encoded and returned to the client

type Middleware

type Middleware func(HandlerFunc) HandlerFunc

Middleware :

type Request

type Request struct {
	*http.Request

	// Params contains a map of the URL parameters, with keys obtained from the route path
	Params map[string]string
}

Request is a wrapper that extends http.Request with convenience attributes

type Response

type Response struct {
	http.ResponseWriter
}

Response is simply a wrapper around the http.ResponseWritter func

type Server

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

Server :

func NewServer

func NewServer(config *ServerConfig) (*Server, error)

NewServer :

func (*Server) Run

func (s *Server) Run()

Run :

type ServerConfig

type ServerConfig struct {
	// Server bind address in the form host:port
	BindAddress string

	// Handlers contains a mapping of paths to http.Handler structs
	Handlers map[string]HandlerAdapter

	// Logger
	Logger log.Logger
}

ServerConfig :

func DefaultConfig

func DefaultConfig() *ServerConfig

DefaultConfig :

func (*ServerConfig) Merge

func (s *ServerConfig) Merge(b *ServerConfig) *ServerConfig

Merge :

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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