Documentation ¶
Index ¶
- func Aegis(config AegisConfig) celerity.MiddlewareHandler
- func CORS() celerity.MiddlewareHandler
- func CORSWithConfig(config CORSConfig) celerity.MiddlewareHandler
- func JSONMiddleware() celerity.MiddlewareHandler
- func RequestLogger() celerity.MiddlewareHandler
- func RequestLoggerWithConfig(rlc RequestLoggerConfig) celerity.MiddlewareHandler
- func Rewrite(rules RewriteRules) celerity.MiddlewareHandler
- type AegisAdapter
- type AegisConfig
- type CORSConfig
- type RequestLoggerConfig
- type RequestLoggerData
- type RewriteRules
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Aegis ¶
func Aegis(config AegisConfig) celerity.MiddlewareHandler
Aegis - Create an aegis middleware instance
func CORS ¶
func CORS() celerity.MiddlewareHandler
CORS returns a CORS middleware with sane defaults
CORS middleware can be invoked with a configuration using CORSWithConfig. This middleware will add CORS headers to all requests matched by the scope. This middleware must be used as Preroute middleware using the Scope.Pre function, instead of Scope.Use.
func CORSWithConfig ¶
func CORSWithConfig(config CORSConfig) celerity.MiddlewareHandler
CORSWithConfig returns a CORS middleware handler with a specific configuration.
func JSONMiddleware ¶
func JSONMiddleware() celerity.MiddlewareHandler
JSONMiddleware - Adds content type json headers
func RequestLogger ¶
func RequestLogger() celerity.MiddlewareHandler
RequestLogger creates a new logger middleware with sane defaults.
func RequestLoggerWithConfig ¶
func RequestLoggerWithConfig(rlc RequestLoggerConfig) celerity.MiddlewareHandler
RequestLoggerWithConfig creates a new Request logger with the given config.
func Rewrite ¶
func Rewrite(rules RewriteRules) celerity.MiddlewareHandler
Rewrite returns a rewrite middleware with the given rewrite rules
Types ¶
type AegisAdapter ¶
AegisAdapter - Adapter interface for handling authentication
type CORSConfig ¶
type CORSConfig struct { AllowOrigins []string AllowMethods []string AllowHeaders []string AllowCredentials bool ExposeHeaders []string Age int }
CORSConfig configures the cors middleware and can be passed to CORSWithConfig.
type RequestLoggerConfig ¶
RequestLoggerConfig configures the request logger middleware and can be passed to RequestLoggerWithConfig.
func NewLoggerConfig ¶
func NewLoggerConfig() RequestLoggerConfig
NewLoggerConfig creates a default configuration for RequestLoggerConfig.
type RequestLoggerData ¶
type RequestLoggerData struct { Now time.Time URL *url.URL Duration time.Duration C *celerity.Context R *celerity.Response }
RequestLoggerData is used to format the output for console and file logging operations.
type RewriteRules ¶
RewriteRules is a set of rules used to rewrite and transform the incoming url. See the Server.Rewrite function.