router

package
v0.0.0-...-c5b96c6 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router instance

func New

func New(router *web.Router, ctx interface{}, path string) Router

New Creates an API router instance (internal use only)

func (*Router) GetBaseRouter

func (r *Router) GetBaseRouter() *web.Router

GetBaseRouter Fetch the underlying router. Note that operations on this will bypass any GoAPI magic

func (*Router) Middleware

func (r *Router) Middleware(fn interface{})

Middleware Attach standard middleware to an API router

func (*Router) Register

func (r *Router) Register(route string, method string, f interface{}) error

Register registers a basic http or gocraft/web route handler without any modification This does not currently call any meta plugins.

func (*Router) RegisterEndpoint

func (r *Router) RegisterEndpoint(route string, method string, f interface{}) error

RegisterEndpoint Register a route to the API router. This takes a typed endpoint and generates a wrapper to handle translation and validation of input and output structures, as well as error handling for the endpoint.

func (*Router) RegisterMiddleware

func (r *Router) RegisterMiddleware() error

RegisterMiddleware Attach dependency injected middleware to API router. This is not yet supported

func (*Router) Subrouter

func (r *Router) Subrouter(ctx interface{}, path string) *Router

Subrouter Creates a subrouter with a given context and path. As with gocraft, this context must have a pointer to the parent context as it's first field

Jump to

Keyboard shortcuts

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