middleware

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"vef:middleware",
	fx.Provide(
		fx.Annotate(
			NewRequestIDMiddleware,
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewLoggerMiddleware,
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewRecoveryMiddleware,
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewRequestRecordMiddleware,
			fx.ParamTags(`group:"vef:spa"`),
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewCORSMiddleware,
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewContentTypeMiddleware,
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewCompressionMiddleware,
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewHeadersMiddleware,
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
		fx.Annotate(
			NewSPAMiddleware,
			fx.ParamTags(`group:"vef:spa"`),
			fx.ResultTags(`group:"vef:app:middlewares"`),
		),
	),
)

Functions

func NewCORSMiddleware added in v0.32.0

func NewCORSMiddleware(config *config.CORSConfig) app.Middleware

func NewCompressionMiddleware

func NewCompressionMiddleware() app.Middleware

func NewContentTypeMiddleware

func NewContentTypeMiddleware() app.Middleware

NewContentTypeMiddleware enforces JSON/multipart for state-changing requests on the API surface, where the dispatcher parses JSON bodies. Other surfaces (MCP, the storage proxy, the integration inbound gateway) own their body formats — a vendor callback may legitimately POST XML.

func NewHeadersMiddleware

func NewHeadersMiddleware() app.Middleware

NewHeadersMiddleware sets headers after handler execution to avoid being overwritten by application code.

func NewLoggerMiddleware

func NewLoggerMiddleware() app.Middleware

NewLoggerMiddleware creates request-scoped loggers to correlate all log entries within a request.

func NewRecoveryMiddleware

func NewRecoveryMiddleware() app.Middleware

func NewRequestIDMiddleware

func NewRequestIDMiddleware() app.Middleware

func NewRequestRecordMiddleware

func NewRequestRecordMiddleware(spaConfigs []*middleware.SPAConfig) app.Middleware

NewRequestRecordMiddleware skips SPA static assets to reduce log noise while capturing API traffic.

func NewSPAMiddleware

func NewSPAMiddleware(configs []*middleware.SPAConfig) app.Middleware

Types

type SimpleMiddleware

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

func (*SimpleMiddleware) Apply

func (m *SimpleMiddleware) Apply(router fiber.Router)

func (*SimpleMiddleware) Name

func (m *SimpleMiddleware) Name() string

func (*SimpleMiddleware) Order

func (m *SimpleMiddleware) Order() int

Jump to

Keyboard shortcuts

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