service

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server           *server.Config
	MostPopularToken string
	SemanticToken    string
}

Config is a struct to contain all the needed configuration for our MixedService

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL