server

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HTTPEngineModule = fx.Module("httpengine",
	fx.Provide(
		NewEngine,
	),
	fx.Decorate(wrapLogger),
)
View Source
var HTTPServerModule = fx.Module("httpserver",
	fx.Provide(
		New,
	),
	fx.Decorate(wrapLogger),
)

Functions

func AsService added in v0.8.20

func AsService(f any) any

AsService annotates the given constructor to state that it provides a HTTP service to the "httpservices" group.

func InjectToHeaders added in v0.8.13

func InjectToHeaders(tracer *tracesdk.TracerProvider) gin.HandlerFunc

func NewEngine added in v0.8.20

func NewEngine(p EngineParams) *gin.Engine

Types

type EngineParams added in v0.8.20

type EngineParams struct {
	fx.In

	Logger   *zap.Logger
	Config   *config.Config
	DB       *sql.DB
	TP       *tracesdk.TracerProvider
	TokenMgr *auth.TokenMgr

	Services []Service `group:"httpservices"`
}

type HTTPServer added in v0.8.10

type HTTPServer *http.Server

type Params added in v0.8.10

type Params struct {
	fx.In

	LC fx.Lifecycle

	Logger *zap.Logger
	Config *config.Config
	Engine *gin.Engine
}

type Result added in v0.8.10

type Result struct {
	fx.Out

	Server HTTPServer
}

func New added in v0.8.20

func New(p Params) (Result, error)

New builds an HTTP server that will begin serving requests when the Fx application starts.

type Service added in v0.8.20

type Service interface {
	RegisterHTTP(e *gin.Engine)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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