router

package
v0.0.0-...-5cd0c88 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CorsMiddleware = func(corsOrigin string, corsCredentials string) func(h http.Handler) http.Handler {
	return func(h http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			w.Header().Set("Access-Control-Allow-Origin", corsOrigin)
			w.Header().Set("Access-Control-Allow-Credentials", corsCredentials)
			w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
			h.ServeHTTP(w, r)
		})
	}
}
View Source
var DebugMiddleware = func(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

		requestObject := map[string]string{
			"url":    r.URL.String(),
			"Method": r.Method,
		}

		requestProperties, err := gss.SerializeString(requestObject, "properties", []string{}, gss.NoLimit)
		if err != nil {
			panic(err)
		}

		fmt.Println("# Request #")
		fmt.Println(requestProperties)
		next.ServeHTTP(w, r)
	})
}

Functions

This section is empty.

Types

type RailgunRouter

type RailgunRouter struct {
	*Router
	Viper           *viper.Viper
	Catalog         *catalog.RailgunCatalog
	PublicKey       *rsa.PublicKey
	PrivateKey      *rsa.PrivateKey
	ValidMethods    []string
	SessionDuration time.Duration
}

func NewRailgunRouter

func NewRailgunRouter(v *viper.Viper, railgunCatalog *catalog.RailgunCatalog, requests chan request.Request, messages chan interface{}, errors chan error, awsSessionCache *gocache.Cache, publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, validMethods []string) *RailgunRouter

func (*RailgunRouter) AddAuthenticateHandler

func (r *RailgunRouter) AddAuthenticateHandler(name string, path string)

func (*RailgunRouter) AddGroupHandler

func (r *RailgunRouter) AddGroupHandler(name string, path string, t reflect.Type)

func (*RailgunRouter) AddHealthHandler

func (r *RailgunRouter) AddHealthHandler(name string, path string)

func (*RailgunRouter) AddHomeHandler

func (r *RailgunRouter) AddHomeHandler(name string, path string)

func (*RailgunRouter) AddItemHandler

func (r *RailgunRouter) AddItemHandler(name string, path string, t reflect.Type, singular string, plural string)

func (*RailgunRouter) AddJobExecHandler

func (r *RailgunRouter) AddJobExecHandler(name string, path string)

func (*RailgunRouter) AddLayerMaskHandler

func (r *RailgunRouter) AddLayerMaskHandler(name string, path string)

func (*RailgunRouter) AddLayerTileHandler

func (r *RailgunRouter) AddLayerTileHandler(name string, path string)

func (*RailgunRouter) AddObjectHandler

func (r *RailgunRouter) AddObjectHandler(name string, path string, object interface{})

func (*RailgunRouter) AddServiceExecHandler

func (r *RailgunRouter) AddServiceExecHandler(name string, path string)

func (*RailgunRouter) AddSwaggerHandler

func (r *RailgunRouter) AddSwaggerHandler(name string, path string)

func (*RailgunRouter) AddWorkflowExecHandler

func (r *RailgunRouter) AddWorkflowExecHandler(name string, path string)

func (*RailgunRouter) NewBaseHandler

func (r *RailgunRouter) NewBaseHandler() *handlers.BaseHandler

type Router

type Router struct {
	*mux.Router
	Requests        chan request.Request
	Messages        chan interface{}
	Errors          chan error
	AwsSessionCache *gocache.Cache
}

func NewRouter

func NewRouter(requests chan request.Request, messages chan interface{}, errors chan error, awsSessionCache *gocache.Cache) *Router

Jump to

Keyboard shortcuts

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