fxmodules

package
v0.19.910 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIModule = fx.Module("api",
	fx.Provide(spa.NewHandler),
	fx.Provide(NewAPI),
	fx.Invoke(func(lc fx.Lifecycle, api *API, shutdowner fx.Shutdowner) {
		lc.Append(api.lifecycleHooks(shutdowner))
	}),
)
View Source
var InfrastructureModule = fx.Module("infrastructure",
	fx.Provide(internal.NewConfig),
	fx.Provide(newLogger),
	fx.Provide(NewMetricsWriter),
)
View Source
var MiddlewaresModule = fx.Module("middlewares",
	fx.Provide(ginmw.AsMiddleware(metricsmw.New)),
	fx.Provide(ginmw.AsMiddleware(corsmw.New)),
)

Functions

func NewMetricsWriter added in v0.19.894

func NewMetricsWriter(lc fx.Lifecycle, cfg *internal.Config, l *zap.Logger) (metrics.Writer, error)

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(p APIParams) (*API, error)

type APIParams

type APIParams struct {
	fx.In

	Config      *internal.Config
	Logger      *zap.Logger
	Middlewares []ginmw.Middleware `group:"middlewares"`
	Services    []Service          `group:"services"`
	SPA         *spa.Handler
}

type Service

type Service interface {
	RegisterRoutes(*gin.Engine) error
}

Service is the interface that handler groups implement to register routes.

Jump to

Keyboard shortcuts

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