Documentation ¶
Index ¶
- Constants
- func AddPrioritizedMiddleware(middleware func(http.Handler) http.Handler, priority int) bool
- func InitializeServer(port int) error
- type SuluvirRouter
- func (s *SuluvirRouter) GetMuxRouterForTestingPurposes() *mux.Router
- func (s *SuluvirRouter) GetRoute(name string) *mux.Route
- func (s *SuluvirRouter) HandleFunc(path string, f func(http.ResponseWriter, *http.Request)) *mux.Route
- func (s *SuluvirRouter) Handler(path string, handler http.Handler) *mux.Route
- func (s *SuluvirRouter) Subrouter(pathPrefix string) *SuluvirRouter
Constants ¶
View Source
const ( // LOG_MIDDLEWARE_PRIORITY sets the priority for the log middleware LOG_MIDDLEWARE_PRIORITY = 0 // AUTHENTICATION_MIDDLEWARE_PRIORITY sets the priority for the authentication middleware AUTHENTICATION_MIDDLEWARE_PRIORITY = 1 // PERMISSION_MIDDLEWARE_PRIORITY sets the priority for the permission middleware PERMISSION_MIDDLEWARE_PRIORITY = 2 // STAY_SIGNED_IN_PRIORITY sets the priority for the "stay signed in functionality" STAY_SIGNED_IN_PRIORITY = -1 )
some well known middlewares with given priorities
Variables ¶
This section is empty.
Functions ¶
func AddPrioritizedMiddleware ¶
AddPrioritizedMiddleware adds a middleware with a priority to the stack of middlewares for each request. The lower the priority, the earlier this middleware will be executed. All other middlewares will be executed after the prioritized ones. This function will log an error and not adds the middleware if two middlewares with the same priority are given. This function returns a boolean indicating the success of adding the middleware to the stack.
func InitializeServer ¶
Types ¶
type SuluvirRouter ¶
type SuluvirRouter struct {
// contains filtered or unexported fields
}
func GetRouter ¶
func GetRouter() *SuluvirRouter
func (*SuluvirRouter) GetMuxRouterForTestingPurposes ¶
func (s *SuluvirRouter) GetMuxRouterForTestingPurposes() *mux.Router
GetMuxRouterForTestingPurposes returns the underlying mus router to be used for testing purposes
func (*SuluvirRouter) HandleFunc ¶
func (s *SuluvirRouter) HandleFunc(path string, f func(http.ResponseWriter, *http.Request)) *mux.Route
func (*SuluvirRouter) Subrouter ¶
func (s *SuluvirRouter) Subrouter(pathPrefix string) *SuluvirRouter
Click to show internal directories.
Click to hide internal directories.