middlewares

package
v0.0.0-...-1a5deed Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContextKeyUserID is the get to fetch the user id from the context
	ContextKeyUserID = internalContext.Key("user-id")

	// ContextKeyLanguageTag is the key for to get the language tag from the context
	ContextKeyLanguageTag = internalContext.Key("language-tag")

	// ContextKeyJWTToken is the auth token
	ContextKeyJWTToken = internalContext.Key("jwt-token")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
}

Client provides the collection of middlewares.

func New

func New() Client

New creates a middle ware client

func (Client) AddLanguageTag

func (middleware Client) AddLanguageTag() func(http.Handler) http.Handler

AddLanguageTag adds the language tag to the the context

func (Client) EnrichUserID

func (middleware Client) EnrichUserID(jwtService jwt.Service) func(http.Handler) http.Handler

EnrichUserID adds the user id to the context

func (Client) LogRequest

func (middleware Client) LogRequest(logger logger.Logger) func(http.Handler) http.Handler

LogRequest logs the incoming HTTP request & its duration.

Jump to

Keyboard shortcuts

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