Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
server.EndpointsGetter
InitializeAPI(c *core.Controller) error
SetRoutes(router *httprouter.Router) error
}
API is an interface used for the server API's.
type Option ¶
type Option func(o *Options)
Option is a function that changes options in some way.
func WithAPIVersion ¶
WithAPIVersion is a server option that stores the api for provided version.
func WithHostname ¶
WithHostname sets the hostname option for the server.
func WithTLSConfig ¶
WithTLSConfig sets the tls config option for the server.
type Options ¶
type Options struct {
VersionedAPIs map[string][]API
APIs []API
Hostname string
Port int
TLSConfig *tls.Config
}
Options are the http server options.
type Server ¶
type Server struct {
Options *Options
Endpoints []*server.Endpoint
Router *httprouter.Router
Server http.Server
Controller *core.Controller
}
Server is an http server implementation. It implements neuron/server.Server interface.
func (*Server) GetEndpoints ¶
GetEndpoints gets all stored server endpoints.
func (*Server) Initialize ¶
func (s *Server) Initialize(c *core.Controller) error
Initialize initializes server with provided options.
type VersionedServer ¶
type VersionedServer struct {
Router *httprouter.Router
Endpoints []*server.Endpoint
Options *Options
// contains filtered or unexported fields
}
VersionedServer is a server.VersionedServer implementation for the http Server with multiple API versions.
func NewVersioned ¶
func NewVersioned(options ...Option) *VersionedServer
NewVersioned creates new versioned API.
func (*VersionedServer) GetEndpoints ¶
func (v *VersionedServer) GetEndpoints() []*server.Endpoint
GetEndpoints implements server.VersionedServer.
func (*VersionedServer) InitializeVersion ¶
func (v *VersionedServer) InitializeVersion(version string, c *core.Controller) error
InitializeVersion initializes all API stored for given 'version'.
func (*VersionedServer) Serve ¶
func (v *VersionedServer) Serve() error
Serve implements server.VersionedServer.