Documentation ¶
Overview ¶
Package middleware defines the signature/type which can be added as a middleware to Webgo. It also has a 2 default middleware access logs & CORS handling. This package also provides 2 chainable to handlers to handle CORS in individual routes
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessLog ¶
func AccessLog(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc)
AccessLog is a middleware which prints access log to stdout
func Cors ¶
func Cors(allowedOrigins ...string) http.HandlerFunc
Cors is a basic CORS middleware which can be added to individual handlers
func CorsOptions ¶
func CorsOptions(allowedOrigins ...string) http.HandlerFunc
CorsOptions is a CORS middleware only for OPTIONS request method
func CorsWrap ¶
func CorsWrap(allowedOrigins ...string) func(http.ResponseWriter, *http.Request, http.HandlerFunc)
CorsWrap is a single Cors middleware which can be applied to the whole app at once
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.