Documentation ¶
Index ¶
- func With(ctx context.Context, app *App) context.Context
- func WrapHandler(app *App, fn HandlerFunc) echo.HandlerFunc
- type App
- type CORS
- type Config
- type HandlerFunc
- type Router
- func (r *Router) DELETE(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) GET(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) Group(path string, handlers ...echo.MiddlewareFunc) *Router
- func (r *Router) OPTIONS(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) PATCH(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) POST(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) PUT(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapHandler ¶
func WrapHandler(app *App, fn HandlerFunc) echo.HandlerFunc
WrapHandler wraps a handler function into a gin.HandlerFunc.
Types ¶
type App ¶
type App struct { Config *Config IDM *idm.Provider Door *door.Controller Holidays openinghours.HolidayGetter RosterdServer string }
App holds dependencies for cis API request handlers.
func From ¶
From returns the App associated with c. If there is no context assigned to c the request is terminated with 500 Internal Server error.
func FromContext ¶
FromContext returns the App associated with c.
func NewApp ¶
func NewApp( cfg *Config, door *door.Controller, holidays openinghours.HolidayGetter, RosterdServer string, idmProvider *idm.Provider, ) *App
NewApp context creates a new application context.
func (*App) BaseURL ¶
BaseURL returns the base URL if the application as configured in the BaseURL setting. If not configured the Host header of the HTTP request is used.
func (*App) EndpointPath ¶
EndpointPath returns the absolute path to the endpoint.
func (*App) Location ¶
Location returns the location CIS is running at. Deprecated: use Config.Location() instead.
type CORS ¶
type CORS struct { AllowAllOrigins bool AllowOrigins []string AllowMethods []string AllowHeaders []string AllowCredentials bool ExposeHeaders []string MaxAge string AllowWildcard bool AllowBrowserExtensions bool AllowWebSockets bool }
CORS is a type-alias to cors.Config to avoid additional imports in client packages.
type Config ¶
type Config struct { cfgspec.Config `section:"Global"` CORS `section:"CORS"` // contains filtered or unexported fields }
Config holds the complete cisd configuration.
type HandlerFunc ¶
HandlerFunc defines a cis HTTP handler func.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router wraps a gin router interface to use HandlerFunc instead of gin.HandlerFunc.
func (*Router) DELETE ¶
func (r *Router) DELETE(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
DELETE is like echo.Group.PATCH.
func (*Router) GET ¶
func (r *Router) GET(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
GET is like echo.Group.GET.
func (*Router) Group ¶
Group returns a new router that groups handlers at path. It works like echo.Group.Group.
func (*Router) OPTIONS ¶
func (r *Router) OPTIONS(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
OPTIONS is like echo.Group.OPTIONS.
func (*Router) PATCH ¶
func (r *Router) PATCH(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
PATCH is like echo.Group.PATCH.
func (*Router) POST ¶
func (r *Router) POST(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
POST is like echo.Group.POST.
func (*Router) PUT ¶
func (r *Router) PUT(path string, handler HandlerFunc, middlewares ...echo.MiddlewareFunc)
PUT is like echo.Group.PUT.