http

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultResponseEncoder

func DefaultResponseEncoder(w http.ResponseWriter, r *http.Request, v interface{}) error

Types

type Context

type Context interface {
	context.Context
	Request() *http.Request
	Response() http.ResponseWriter
	JSON(code int, v interface{}) error
	Middleware(h Handler) Handler
	Result(code int, v interface{}) error
	Reset(res http.ResponseWriter, req *http.Request)
}

type EncodeResponseFunc

type EncodeResponseFunc func(http.ResponseWriter, *http.Request, interface{}) error

EncodeResponseFunc is encode response func.

type Handler

type Handler = HandlerFunc

Handler defines the handler invoked by Middleware.

type HandlerFunc

type HandlerFunc func(ctx Context) error

type Middleware

type Middleware func(Handler) Handler

Middleware is HTTP middleware.

func Chain

func Chain(m ...Middleware) Middleware

type Server

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

func NewServer

func NewServer(ctx context.Context) *Server

func (*Server) Handle

func (s *Server) Handle(method, path string, handler HandlerFunc, label string)

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) HandlerFunc

func (s *Server) HandlerFunc(path string, handler HandlerFunc) *mux.Route

type Wrapper

type Wrapper = wrapper

Jump to

Keyboard shortcuts

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