Documentation ¶
Overview ¶
Package middleware is responsible for the definition/implementation of middleware functionality. This package will also handle maintaining request Context and Session.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContext ¶
func GetContext(handler http.Handler) http.HandlerFunc
GetContext wraps each request in a function which fills in the context for a given request. This includes setting the User and Session keys and values as necessary for use in later functions.
func JSONError ¶
func JSONError(w http.ResponseWriter, c int, m string)
JSONError returns an error in JSON format with the given status code and message
func RequireAPIKey ¶
func RequireAPIKey(handler http.Handler) http.HandlerFunc
func RequireLogin ¶
func RequireLogin(handler http.Handler) http.HandlerFunc
RequireLogin is a simple middleware which checks to see if the user is currently logged in. If not, the function returns a 302 redirect to the login page.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.