Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the VEF application server. It wraps a Fiber application and manages the HTTP server lifecycle.
func New ¶
New creates a new VEF application instance with the provided dependencies. Returns an error if the application cannot be configured properly.
func (*App) Start ¶
Start starts the VEF application HTTP server. It returns a channel that will receive nil when the server is ready, or an error if the server fails to start. The server runs in a goroutine and can be stopped using the Stop method.
func (*App) Stop ¶
Stop gracefully shuts down the VEF application server. It waits up to 30 seconds for active connections to close.
func (*App) Test ¶
Test sends an HTTP request to the application for testing purposes. This method is designed for unit and integration tests. The optional timeout parameter specifies the maximum duration to wait for a response. If no timeout is provided or timeout is zero, a default timeout of 5 seconds is used. This is higher than Fiber's default (1s) to accommodate CI environments.
type AppParams ¶
type AppParams struct {
fx.In
Config *config.AppConfig
Middlewares []Middleware `group:"vef:app:middlewares"`
APIEngine api.Engine
}
AppParams contains all dependencies required to create a VEF application.
type CustomCtx ¶
type CustomCtx struct {
fiber.DefaultCtx
// contains filtered or unexported fields
}
CustomCtx is a custom Fiber context that extends the default context with additional framework-specific functionality like logger, principal, and database access.
func (*CustomCtx) Principal ¶
Principal returns the authenticated principal (user/system/app) for the current request.
func (*CustomCtx) SetPrincipal ¶
SetPrincipal sets the authenticated principal for the current request.
type Middleware ¶
type Middleware interface {
// Name returns the name of the middleware.
Name() string
// Order returns the order of the middleware.
Order() int
// Apply applies the middleware to the router.
Apply(router fiber.Router)
}
Middleware is a middleware for the app.
type StructValidator ¶
type StructValidator struct{}
StructValidator implements Fiber's struct validator interface.
func (*StructValidator) Validate ¶
func (*StructValidator) Validate(out any) error
Validate delegates to the framework's validator.