restserver

package
v1.17.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MiddlewareExcludeURLPath = map[string]struct{}{"/": {}, "/graphql": {}, "/favicon.ico": {}}
)
View Source
var URLParam = func(r *http.Request, key string) string {
	return chi.URLParam(r, key)
}

URLParam default parse param from url path

Functions

func HTTPMiddlewareCORS added in v1.17.0

func HTTPMiddlewareCORS(
	allowMethods, allowHeaders, allowOrigins []string,
	exposeHeaders []string,
	allowCredential bool,
) func(http.Handler) http.Handler

HTTPMiddlewareCORS middleware for cors

func HTTPMiddlewareTracer added in v1.17.0

func HTTPMiddlewareTracer() func(http.Handler) http.Handler

HTTPMiddlewareTracer middleware wrapper for tracer

func NewServer

func NewServer(service factory.ServiceFactory, opts ...OptionFunc) factory.AppServerFactory

NewServer create new REST server

func WithChainingMiddlewares added in v1.15.0

func WithChainingMiddlewares(handlerFunc http.HandlerFunc, middlewares ...func(http.Handler) http.Handler) http.HandlerFunc

WithChainingMiddlewares chaining middlewares

Types

type OptionFunc added in v1.7.4

type OptionFunc func(*option)

OptionFunc type

func AddGraphQLOption added in v1.12.0

func AddGraphQLOption(opts ...graphqlserver.OptionFunc) OptionFunc

AddGraphQLOption option func

func AddMountRouter added in v1.17.2

func AddMountRouter(fn func(interfaces.RESTRouter)) OptionFunc

AddMountRouter option func

func AddRootMiddlewares added in v1.8.7

func AddRootMiddlewares(middlewares ...func(http.Handler) http.Handler) OptionFunc

AddRootMiddlewares option func, overide root middleware

func SetDebugMode added in v1.7.4

func SetDebugMode(debugMode bool) OptionFunc

SetDebugMode option func

func SetDisableTrace added in v1.17.0

func SetDisableTrace() OptionFunc

SetDisableTrace option func

func SetHTTPPort added in v1.7.4

func SetHTTPPort(port uint16) OptionFunc

SetHTTPPort option func

func SetIncludeGraphQL added in v1.7.4

func SetIncludeGraphQL(includeGraphQL bool) OptionFunc

SetIncludeGraphQL option func

func SetJaegerMaxPacketSize added in v1.7.4

func SetJaegerMaxPacketSize(max int) OptionFunc

SetJaegerMaxPacketSize option func

func SetRootHTTPHandler added in v1.7.4

func SetRootHTTPHandler(rootHandler http.HandlerFunc) OptionFunc

SetRootHTTPHandler option func

func SetRootMiddlewares added in v1.7.7

func SetRootMiddlewares(middlewares ...func(http.Handler) http.Handler) OptionFunc

SetRootMiddlewares option func

func SetRootPath added in v1.7.4

func SetRootPath(rootPath string) OptionFunc

SetRootPath option func

func SetSharedListener added in v1.7.4

func SetSharedListener(sharedListener cmux.CMux) OptionFunc

SetSharedListener option func

func SetTLSConfig added in v1.16.3

func SetTLSConfig(tlsConfig *tls.Config) OptionFunc

SetTLSConfig option func

Jump to

Keyboard shortcuts

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