handler

package
v0.0.0-...-a67b36e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAllowedOrigins

func WithAllowedOrigins(origins ...string) func(*Handler)

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) Apply

func (handler *Handler) Apply(options ...func(*Handler))

Apply applies an API-CORS configuration on the API instance

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

Jump to

Keyboard shortcuts

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