-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.go
More file actions
48 lines (37 loc) · 737 Bytes
/
Copy pathengine.go
File metadata and controls
48 lines (37 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package middleware
import (
"net/http"
"github.com/evorax/middleware/internal"
)
type Context struct {
Writer http.ResponseWriter
Request *http.Request
Params internal.Params
}
type HandlerFunc func(*Context)
type route struct {
method string
pattern string
handler HandlerFunc
}
type Engine struct {
routes []*route
staticDir string
}
type Cookie struct {
RawExpires string
MaxAge int
Secure bool
SameSite SameSite
Raw string
Unparsed []string
HttpOnly bool
}
type SameSite int
type Headers map[string]string
func New(staticDir ...string) *Engine {
if len(staticDir) >= 1 {
return &Engine{routes: []*route{}, staticDir: staticDir[0]}
}
return &Engine{routes: []*route{}, staticDir: ""}
}