forked from YaoApp/gou
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.types.go
47 lines (42 loc) · 1.27 KB
/
api.types.go
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
package gou
// API 数据接口
type API struct {
Name string
Source string
Type string
HTTP HTTP
}
// HTTP http 协议服务
type HTTP struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description,omitempty"`
Group string `json:"group,omitempty"`
Guard string `json:"guard,omitempty"`
Paths []Path `json:"paths,omitempty"`
}
// Path HTTP Path
type Path struct {
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Path string `json:"path"`
Method string `json:"method"`
Process string `json:"process"`
Guard string `json:"guard,omitempty"`
In []string `json:"in,omitempty"`
Out Out `json:"out,omitempty"`
}
// Out http 输出
type Out struct {
Status int `json:"status"`
Type string `json:"type,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
// Server API 服务配置
type Server struct {
Debug bool `json:"debug,omitempty"`
Port int `json:"port,omitempty"`
Host string `json:"host,omitempty"`
Root string `json:"root,omitempty"` // API 根目录
Allows []string `json:"allows,omitempty"` // 许可跨域访问域名
}