Documentation
¶
Index ¶
- func API(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc
- func AdminAPI(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc
- func CORS(config interfaces.AppConfig, logger *zap.Logger) func(http.Handler) http.Handler
- func CORSAllowedHeaders() []string
- func CORSAllowedMethods() []string
- func CORSOriginValidator(config interfaces.AppConfig, logger *zap.Logger) func(string) bool
- func UserAPI(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc
- type APIHandlerFunc
- type AuthorizerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func API ¶
func API(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc
API Create a handler which is accessible by any user, authenticated or not.
func AdminAPI ¶
func AdminAPI(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc
AdminAPI Create a handler which is accessible only by authenticated admins.
func CORS ¶
CORS Returns a http.Handler wrapper function for adding CORS validation to an application.
func CORSAllowedHeaders ¶
func CORSAllowedHeaders() []string
CORSAllowedHeaders Return a list of allowed CORS headers.
func CORSAllowedMethods ¶
func CORSAllowedMethods() []string
CORSAllowedMethods Return a list of allowed CORS methods.
func CORSOriginValidator ¶
CORSOriginValidator Generates a CORS origin validator function.
func UserAPI ¶
func UserAPI(app interfaces.App, handler APIHandlerFunc) http.HandlerFunc
UserAPI Create a handler which is accessible only by authenticated users and admins.
Types ¶
type APIHandlerFunc ¶
type APIHandlerFunc func(req interfaces.RequestContext) *views.Response
APIHandlerFunc A HTTP handler which conforms to our API framework.
type AuthorizerFunc ¶
type AuthorizerFunc func(req interfaces.RequestContext) bool
func AdminAuthorizer ¶
func AdminAuthorizer() AuthorizerFunc
func AnonAuthorizer ¶
func AnonAuthorizer() AuthorizerFunc
func UserAuthorizer ¶
func UserAuthorizer() AuthorizerFunc
Click to show internal directories.
Click to hide internal directories.