Documentation
¶
Overview ¶
Package common_endpoints provides common HTTP endpoint descriptors for services. It offers a simple way to register standard endpoints like Swagger documentation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonEndpoints ¶
func CommonEndpoints(basePath string, opts ...CommonEndpointOption) []cluster.EndpointDescriptor
CommonEndpoints creates a slice of cluster.EndpointDescriptor for common service endpoints. It accepts a basePath for URL path prefix and variadic CommonEndpointOption functions to configure endpoints. Returns a slice of endpoint descriptors that can be registered with a cluster router. Currently supports Swagger documentation endpoint when configured via WithSwaggerEndpoint.
Types ¶
type CommonEndpointOption ¶
type CommonEndpointOption func(cfg *commonEndpointsCfg)
CommonEndpointOption is a functional option for configuring commonEndpointsCfg.
func WithSwaggerEndpoint ¶
func WithSwaggerEndpoint(swagger []byte) CommonEndpointOption
WithSwaggerEndpoint configures the CommonEndpoints builder to include a Swagger endpoint. The swagger parameter should contain the JSON-formatted Swagger specification. The endpoint is exposed at {basePath}/swagger and is accessible via HTTP GET.