http

package
v0.0.0-...-f82f096 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New creates a new instance of the HTTP producer with the provided configuration.

Types

type Config

type Config struct {
	Port        int `yaml:"port"`
	IP          string
	CacheExpiry time.Duration
	DCOSRole    string
}

Config for the HTTP producer

type Route

type Route struct {
	Name        string
	Method      string
	Path        string
	HandlerFunc func(*producerImpl) http.HandlerFunc
}

Route defines a single new route for gorilla/mux. This includes an arbitrary name, the HTTP method(s) allowed, the path for the endpoint, and the handler function in producers/http/handlers.go.

When one or more Route structures are defined in a slice, they can be used to programatically create a gorilla/mux router, like so:

		for _, route := range routes {
 		router.NewRoute() ...

Although arbitrary, up to this point our naming convention for Name has been:

  • convert slashes to underscores
  • remove any params ('id', etc) from the Name

Jump to

Keyboard shortcuts

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