routing

package
v0.0.0-...-235c51f Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//JWTContextKey is used to set the ContextKey of the JWT middleware
	JWTContextKey = "user_token"
)

Variables

This section is empty.

Functions

func AddJWTMiddleware

func AddJWTMiddleware(jwtSecretKey string, skipper func(c echo.Context) bool)

AddJWTMiddleware will add a JWT middleware

func InitEasyRouter

func InitEasyRouter()

InitEasyRouter initializes the local/private instance/singleton of _easyRouter

func InitRouter

func InitRouter(version, gitSha1 string, debugMode bool, responseDelay time.Duration, sentryClient *raven.Client)

InitRouter will initialize the router

func MiddlewareRecoverSentry

func MiddlewareRecoverSentry(client *raven.Client, config *middleware.RecoverConfig) echo.MiddlewareFunc

MiddlewareRecoverSentry returns a middleware which recovers from panics anywhere in the chain and sends the event to Sentry using the client and handles the control to the centralized HTTPErrorHandler

func MiddlewareResponseDelay

func MiddlewareResponseDelay(duration time.Duration) echo.MiddlewareFunc

func MiddlewareResponseVersion

func MiddlewareResponseVersion(version, gitSha1 string) echo.MiddlewareFunc

MiddlewareResponseVersion is a middleware to add X-VERSION and X-SHA1 to response headers

func Router

func Router() *echo.Echo

Router will return the singleton router instance

Types

type EasyHandlerFunc

type EasyHandlerFunc func(c echo.Context, taskCtx *tasks.Context)

EasyHandlerFunc is a simple func receiving a echo.Context and a tasks.Context

type EasyRouterStruct

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

EasyRouterStruct is a simple struct to manage registering of routes

func EasyRouter

func EasyRouter() *EasyRouterStruct

EasyRouter returns the local/private instance/singleton of _easyRouter

func (*EasyRouterStruct) DELETE

func (e *EasyRouterStruct) DELETE(path string) *PendingRegistration

DELETE will register a DELETE method to the path with the given handler and middlewares

func (*EasyRouterStruct) GET

GET will register a GET method to the path with the given handler and middlewares

func (*EasyRouterStruct) POST

POST will register a POST method to the path with the given handler and middlewares

func (*EasyRouterStruct) PUT

PUT will register a PUT method to the path with the given handler and middlewares

type PendingRegistration

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

PendingRegistration holds the route that will get registered

func (*PendingRegistration) Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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