aicra/middleware/types.go

27 lines
660 B
Go
Raw Normal View History

package middleware
import (
"net/http"
)
// Scope represents a list of scope processed by middlewares
// and used by the router to block/allow some uris
// it is also passed to controllers
type Scope []string
// Inspector updates the @Scope passed to it according to
// the @http.Request
2018-07-07 21:15:42 +00:00
type Inspector func(http.Request, *Scope)
2018-07-08 23:34:21 +00:00
// MiddleWare contains all necessary methods
// for a Middleware provided by user/developer
type MiddleWare struct {
2018-07-07 21:15:42 +00:00
Inspect func(http.Request, *Scope)
}
2018-07-08 23:34:21 +00:00
// Registry represents a registry containing all registered
// middlewares to be processed before routing any request
2018-07-08 23:34:21 +00:00
type Registry struct {
Middlewares []MiddleWare
}