http

package
v0.0.0-...-b7c645d Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = func(c config.Config) fx.Option {
	return fx.Options(
		fx.Provide(NewHTTPServerMux),
		fx.Invoke(NewHTTPServer),
		fx.Provide(NewGRPCGateway),
		fx.Provide(Recovery),
		fx.Provide(Logging),
		utils.MaybeProvide(JWT, c.IsSet("UseAuth")),
		utils.MaybeProvide(Tracing, c.IsSet("UseTracing")),
		utils.MaybeOption(Prometheus, c.IsSet("UsePrometheus")),
		utils.MaybeInvoke(RegisterDebug, c.IsSet("UseDebug")),
	)
}

Functions

func NewGRPCGateway

func NewGRPCGateway() *runtime.ServeMux

func NewHTTPServer

func NewHTTPServer(
	lc fx.Lifecycle,
	c config.Config,
	httpIn HTTPIn,
	st status.Manager,
) error

func NewHTTPServerMux

func NewHTTPServerMux() *nhttp.ServeMux

func Register

func Register(mux *http.ServeMux, reg *prometheus.Registry)

func RegisterDebug

func RegisterDebug(mux *http.ServeMux)

Types

type HTTPIn

type HTTPIn struct {
	fx.In

	Mux    *nhttp.ServeMux
	GRPC   *runtime.ServeMux
	Mwares []Middleware `group:"httpmiddleware"`
}

type Middleware

type Middleware func(h http.Handler) http.Handler

type MiddlewareOut

type MiddlewareOut struct {
	fx.Out

	Mware Middleware `group:"httpmiddleware"`
}

func CORS

func CORS() MiddlewareOut

func JWT

func JWT(jm auth.JWTManager, am auth.ACL) MiddlewareOut

func Logging

func Logging() MiddlewareOut

func PromMware

func PromMware() MiddlewareOut

func Recovery

func Recovery() MiddlewareOut

func Tracing

func Tracing(tracer opentracing.Tracer) MiddlewareOut

Jump to

Keyboard shortcuts

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