Documentation ¶
Overview ¶
Package route contains the request context. Each request will have its own instance of RequestContext filled by the middleware code in the api-context-wrapper.go (parent package).
Each value here should be assumed valid only per request only, with some exceptions like the logger.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnonymousRoute ¶
func (AnonymousRoute) GetMethod ¶
func (route AnonymousRoute) GetMethod() string
func (AnonymousRoute) GetPath ¶
func (route AnonymousRoute) GetPath() string
func (AnonymousRoute) IsSecure ¶
func (route AnonymousRoute) IsSecure() bool
type AuthMiddleware ¶
type AuthMiddleware interface {
Intercept(handler SecureHandler) Handler
}
type Controller ¶
type Controller interface {
ListRoutes() []Route
}
type Handler ¶
type Handler = func( w http.ResponseWriter, r *http.Request, params httprouter.Params, context RequestContext, )
type Middleware ¶
type RequestContext ¶
type RequestContext struct { // ReqUUID is the request unique ID ReqUUID uuid.UUID // Logger is a custom field logger for the request Logger logrus.FieldLogger }
RequestContext is the context of the request, for request-dependent parameters
type Route ¶
Route is the description of an endpoint / API route. A controller will return the list of its routes, instead of registering them directly to be independent of the underlying routing library.
type SecureHandler ¶
type SecureHandler func( w http.ResponseWriter, r *http.Request, params httprouter.Params, context SecureRequestContext, )
type SecureRequestContext ¶
type SecureRequestContext struct { UserId string RequestContext }
type SecureRoute ¶
type SecureRoute struct { Method string Path string Handler SecureHandler }
func (SecureRoute) GetMethod ¶
func (route SecureRoute) GetMethod() string
func (SecureRoute) GetPath ¶
func (route SecureRoute) GetPath() string
func (SecureRoute) IsSecure ¶
func (route SecureRoute) IsSecure() bool
Click to show internal directories.
Click to hide internal directories.