webserver

package
v0.0.55 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpMethodToMethodString added in v0.0.33

func HttpMethodToMethodString(httpMethod HttpMethod) string

Types

type ContextCloseFuncType added in v0.0.37

type ContextCloseFuncType func()

func DefaultGetContext added in v0.0.19

func DefaultGetContext(r *http.Request, funcInfo *delivery.HandleFuncInfo) (context.Context, ContextCloseFuncType, error)

type CreateInternalErrorRspFuncType added in v0.0.22

type CreateInternalErrorRspFuncType func(handleErr error, reqMessageName string) (proto.Message, bool, error)

type GetHandleContextFuncType added in v0.0.19

type GetHandleContextFuncType func(r *http.Request, funcInfo *delivery.HandleFuncInfo) (context.Context, ContextCloseFuncType, error)

type HttpError added in v0.0.42

type HttpError struct {
	StatusCode int
	Message    string
}

func (*HttpError) Error added in v0.0.42

func (o *HttpError) Error() string

type HttpMethod added in v0.0.33

type HttpMethod int
const (
	HttpMethodGet HttpMethod = 1 << iota
	MHttpMethodPost
	HttpMethodOptions
)

func MethodStringToHttpMethod added in v0.0.33

func MethodStringToHttpMethod(method string) HttpMethod

func (HttpMethod) Match added in v0.0.33

func (o HttpMethod) Match(method string) bool

func (HttpMethod) ToString added in v0.0.33

func (o HttpMethod) ToString() string

type MiddlewareFuncType added in v0.0.38

type MiddlewareFuncType func(w http.ResponseWriter, r *http.Request, funcInfo *delivery.HandleFuncInfo) bool

type WebServer

type WebServer struct {
	ServeMux                   *http.ServeMux
	OnHandleFinishedFunc       delivery.OnHandleFinishedFuncType
	GetHandleContextFunc       GetHandleContextFuncType
	CreateInternalErrorRspFunc CreateInternalErrorRspFuncType
	// contains filtered or unexported fields
}

func NewWebServer added in v0.0.8

func NewWebServer() *WebServer

func (*WebServer) RegistFunc added in v0.0.32

func (o *WebServer) RegistFunc(baseUrl string, httpMethod HttpMethod, middlewares []MiddlewareFuncType, f interface{})

f type must be HandleFuncType

func (*WebServer) RegistFuncs added in v0.0.32

func (o *WebServer) RegistFuncs(baseUrl string, httpMethod HttpMethod, middlewares []MiddlewareFuncType, f ...interface{})

f type must be HandleFuncType

func (*WebServer) Start

func (o *WebServer) Start(addr string) error

func (*WebServer) Stop

func (o *WebServer) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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