MSP-625 init middleware

This commit is contained in:
DeniskaRediska authored and d1slike committed 2022-07-27 10:44:07 +03:00
1 parent 39a7899a98
commit db3b6aa32f
1 file changed
+27
+27
View File
@@ -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
}