Documentation ¶
Index ¶
- func AccessLogHandler(next http.Handler) http.Handler
- func DBFromContext(ctx context.Context) *mgo.Session
- func FromAuthHeader(r *http.Request) (string, error)
- func FromContext(ctx context.Context) log.Entry
- func FromRequest(r *http.Request) log.Entry
- func IsValidAuth(tokenString string) bool
- func LoggingHandler(next http.Handler) http.Handler
- func MongoHandler(next http.Handler) http.Handler
- func PanicRecoveryHandler(next http.Handler) http.Handler
- func TimeoutHandler(h http.Handler) http.Handler
- func WithAuth(next http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessLogHandler ¶
AccessLogHandler log any HTTP request made to the application.
func DBFromContext ¶
DBFromContext gets the db out of the context.
func FromAuthHeader ¶
FromAuthHeader is a "TokenExtractor" that takes a give request and extracts the JWT token from the Authorization header.
func FromContext ¶
FromContext gets the logger out of the context.
func FromRequest ¶
FromRequest gets the logger from the request's context.
func IsValidAuth ¶
IsValidAuth returns true if the token submitted is valid otherwise false.
func LoggingHandler ¶
LoggingHandler set up Fields reused by every log instance.
func MongoHandler ¶
MongoHandler insert Mgo.session in context and serve the request.
func PanicRecoveryHandler ¶
PanicRecoveryHandler avoids application restarts in case of panic error.
func TimeoutHandler ¶
TimeoutHandler end the request after 2 seconds.
Types ¶
This section is empty.