Documentation ¶
Index ¶
- type JSONPubService
- func (s *JSONPubService) JSONEndpoints() map[string]map[string]server.JSONEndpoint
- func (s *JSONPubService) JSONMiddleware(j server.JSONEndpoint) server.JSONEndpoint
- func (s *JSONPubService) Middleware(h http.Handler) http.Handler
- func (s *JSONPubService) Prefix() string
- func (s *JSONPubService) PublishCats(r *http.Request) (int, interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONPubService ¶
type JSONPubService struct {
// contains filtered or unexported fields
}
JSONPubService will implement server.JSONPubService and handle all requests to the server.
func NewJSONPubService ¶
func NewJSONPubService(cfg *config.Config) *JSONPubService
NewJSONPubService will instantiate a JSONPubService with the given configuration.
func (*JSONPubService) JSONEndpoints ¶
func (s *JSONPubService) JSONEndpoints() map[string]map[string]server.JSONEndpoint
JSONEndpoints is a listing of all endpoints available in the JSONPubService.
func (*JSONPubService) JSONMiddleware ¶
func (s *JSONPubService) 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 (*JSONPubService) Middleware ¶
func (s *JSONPubService) 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 (*JSONPubService) Prefix ¶
func (s *JSONPubService) Prefix() string
Prefix returns the string prefix used for all endpoints within this service.
func (*JSONPubService) PublishCats ¶
func (s *JSONPubService) PublishCats(r *http.Request) (int, interface{}, error)