Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultHTTPAddress for http server
DefaultHTTPAddress = ":8080"
)
Variables ¶
This section is empty.
Functions ¶
func RequestResponseHandler ¶
Types ¶
type Endpoint ¶
type Endpoint struct {
Method string
Path string
Handler HandlerFunc
}
type Opt ¶
type Opt func(*Option)
Opt is used to set the dependencies configurations for the server
func WithConfig ¶
WithConfig will set the Server Config in dependencies
func WithObservabilityServices ¶
func WithObservabilityServices(s *observability.Observability) Opt
WithObservabilityServices will set Metrics, tracer and logger
func WithRoutes ¶
WithRoutes takes the route configuration and registers with the route handler specified in the route configuration
type Option ¶
type Option struct {
// Observability holds the observability services
// used by server: tracing, metrics and logger
// this will be used by all services of server
*observability.Observability
// Config holds all the configurations for server
Config Config
// Routes holds mapping of relative paths to their
// corresponding route configurations.
Routes map[string]Routes
}
Option struct holds all the external package dependency for the server. Options is a separate struct as this can become really big in future We avoid singletons by this simple approach
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the struct to keep gin loosely coupled gin will be present in this layer and each package's server.go only
func (*Server) GetGinEngine ¶
Click to show internal directories.
Click to hide internal directories.