server

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 24 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

func AsService(f any) any

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

func InjectToHeaders

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

func NewEngine

func NewEngine(p EngineParams) (*gin.Engine, error)

Types

type EngineParams

type EngineParams struct {
	fx.In

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

	Services []Service `group:"httpservices"`

	GRPCSrv *grpc.Server
}

type HTTPServer

type HTTPServer *http.Server

type Params

type Params struct {
	fx.In

	LC fx.Lifecycle

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

type Result

type Result struct {
	fx.Out

	Server HTTPServer
}

func New

func New(p Params) (Result, error)

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

type Service

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