Documentation ¶
Index ¶
- type Config
- type SimpleService
- func (s *SimpleService) Endpoints() map[string]map[string]http.HandlerFunc
- func (s *SimpleService) GetCats(w http.ResponseWriter, r *http.Request)
- func (s *SimpleService) GetMostPopular(r *http.Request) (int, interface{}, error)
- func (s *SimpleService) Middleware(h http.Handler) http.Handler
- func (s *SimpleService) Prefix() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { *config.Server MostPopularToken string `envconfig:"MOST_POPULAR_TOKEN"` SemanticToken string `envconfig:"SEMANTIC_TOKEN"` }
Config is a struct to contain all the needed configuration for our SimpleService
type SimpleService ¶
type SimpleService struct {
// contains filtered or unexported fields
}
SimpleService will implement server.SimpleService and handle all requests to the server.
func NewSimpleService ¶
func NewSimpleService(cfg *Config) *SimpleService
NewSimpleService will instantiate a SimpleService with the given configuration.
func (*SimpleService) Endpoints ¶
func (s *SimpleService) Endpoints() map[string]map[string]http.HandlerFunc
JSONEndpoints is a listing of all endpoints available in the SimpleService.
func (*SimpleService) GetCats ¶
func (s *SimpleService) GetCats(w http.ResponseWriter, r *http.Request)
func (*SimpleService) GetMostPopular ¶
func (s *SimpleService) GetMostPopular(r *http.Request) (int, interface{}, error)
func (*SimpleService) Middleware ¶
func (s *SimpleService) 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 (*SimpleService) Prefix ¶
func (s *SimpleService) Prefix() string
Prefix returns the string prefix used for all endpoints within this service.
Click to show internal directories.
Click to hide internal directories.