Documentation ¶
Index ¶
- func WithAllowedOrigins(origins ...string) func(*Handler)
- type Handler
- func (handler *Handler) Apply(options ...func(*Handler))
- func (handler Handler) HandleHideNotification(w http.ResponseWriter, r *http.Request)
- func (handler *Handler) HandleIncomingNotification(w http.ResponseWriter, r *http.Request)
- func (handler *Handler) HandleRemoveNotification(w http.ResponseWriter, r *http.Request)
- func (handler *Handler) HandlerOpenSocket(w http.ResponseWriter, r *http.Request)
- func (handler *Handler) Register(route string, h http.HandlerFunc, ...)
- func (handler *Handler) WithAuth(next http.HandlerFunc) http.HandlerFunc
- func (handler *Handler) WithCors(next http.HandlerFunc) http.HandlerFunc
- func (handler *Handler) WithTracing(next http.HandlerFunc) http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAllowedOrigins ¶
WithAllowedOrigins overrides the default setting for "Access-Control-Allow-Origin: *" with the given origins
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(domain domain.NotificationLogic) *Handler
func (Handler) HandleHideNotification ¶
func (handler Handler) HandleHideNotification(w http.ResponseWriter, r *http.Request)
func (*Handler) HandleIncomingNotification ¶
func (handler *Handler) HandleIncomingNotification(w http.ResponseWriter, r *http.Request)
func (*Handler) HandleRemoveNotification ¶
func (handler *Handler) HandleRemoveNotification(w http.ResponseWriter, r *http.Request)
func (*Handler) HandlerOpenSocket ¶
func (handler *Handler) HandlerOpenSocket(w http.ResponseWriter, r *http.Request)
func (*Handler) Register ¶
func (handler *Handler) Register(route string, h http.HandlerFunc, middleware ...func(http.HandlerFunc) http.HandlerFunc)
AddRoute maps a route to a given http.HandlerFunc and can proxy middleware before the execution of the http.HandlerFunc
func (*Handler) WithAuth ¶
func (handler *Handler) WithAuth(next http.HandlerFunc) http.HandlerFunc
WithAuth acts as middleware before route endpoints. It checks if a user is authenticated or not returns a new http.HandlerFunc to allow multiple other middleware to be wrapped around/after
func (*Handler) WithCors ¶
func (handler *Handler) WithCors(next http.HandlerFunc) http.HandlerFunc
WithCors apply the CORS-Configs of the API to a given API-Endpoint
func (*Handler) WithTracing ¶
func (handler *Handler) WithTracing(next http.HandlerFunc) http.HandlerFunc
WithTracing allows to generate a tracing ID at the entry-point of an request which gets added in the request.Context in order for it to be available through out the code. The tracing ID is an straight forward approach to trace logs from multiple services The Tracing ID is based on the current time and the MAC-Address