Documentation ¶
Index ¶
- type Config
- type MixedService
- func (s *MixedService) Endpoints() map[string]map[string]http.HandlerFunc
- func (s *MixedService) GetCats(w http.ResponseWriter, r *http.Request)
- func (s *MixedService) GetMostPopular(r *http.Request) (int, interface{}, error)
- func (s *MixedService) JSONEndpoints() map[string]map[string]server.JSONEndpoint
- func (s *MixedService) JSONMiddleware(j server.JSONEndpoint) server.JSONEndpoint
- func (s *MixedService) Middleware(h http.Handler) http.Handler
- func (s *MixedService) Prefix() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MixedService ¶
type MixedService struct {
// contains filtered or unexported fields
}
MixedService will implement server.MixedService and handle all requests to the server.
func NewMixedService ¶
func NewMixedService(cfg *Config) *MixedService
NewMixedService will instantiate a MixedService with the given configuration.
func (*MixedService) Endpoints ¶
func (s *MixedService) Endpoints() map[string]map[string]http.HandlerFunc
Endpoints is a listing of all endpoints available in the MixedService.
func (*MixedService) GetCats ¶
func (s *MixedService) GetCats(w http.ResponseWriter, r *http.Request)
func (*MixedService) GetMostPopular ¶
func (s *MixedService) GetMostPopular(r *http.Request) (int, interface{}, error)
func (*MixedService) JSONEndpoints ¶
func (s *MixedService) JSONEndpoints() map[string]map[string]server.JSONEndpoint
JSONEndpoints is a listing of all JSON endpoints available in the MixedService.
func (*MixedService) JSONMiddleware ¶
func (s *MixedService) JSONMiddleware(j server.JSONEndpoint) server.JSONEndpoint
JSONMiddleware provides a JSONEndpoint hook wrapped around all requests. In this implementation, we're using it to provide application logging and to check errors and provide generic responses.
func (*MixedService) Middleware ¶
func (s *MixedService) Middleware(h http.Handler) http.Handler
Middleware provides an http.Handler hook wrapped around all requests. In this implementation, we're using a GzipHandler middleware to compress our responses.
func (*MixedService) Prefix ¶
func (s *MixedService) Prefix() string
Prefix returns the string prefix used for all endpoints within this service.