MSP-625 init middleware
This commit is contained in:
1 parent
39a7899a98
commit
db3b6aa32f
1 file changed
+27
@@ -0,0 +1,27 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Handler interface {
|
||||
Handle(ctx *Context) error
|
||||
}
|
||||
|
||||
type HandlerFunc func(ctx *Context) error
|
||||
|
||||
func (f HandlerFunc) Handle(ctx *Context) error {
|
||||
return f(ctx)
|
||||
}
|
||||
|
||||
type Middleware func(next Handler) Handler
|
||||
|
||||
type Context struct {
|
||||
Id string
|
||||
Request *http.Request
|
||||
ResponseWriter http.ResponseWriter
|
||||
Path string
|
||||
AppId int
|
||||
AdminId int
|
||||
authenticated bool
|
||||
}
|
||||
Reference in new issue
Block a user