22
22
--excludes: Exclude directories and files when searching, comma separated
23
23
--output: Generate markdown files dir, default ./docs/
24
24
--template: Template name or custom template directory, built-in includes markdown and apidocs, default markdown.
25
- --single: If true, generate a single markdown file, default false
25
+ --single: Generate a single markdown file.
26
26
```
27
27
28
28
built-in templates include ` markdown ` and ` apidocs ` , default is ` markdown ` .
@@ -45,7 +45,7 @@ apidocgen \
45
45
46
46
The built-in includes ` markdown ` and ` apidocs ` .
47
47
48
- The built-in template ` apidocs ` is the template for generate website [ apidocs] ( git@ github.com: alovn/apidocs.git ) .
48
+ The built-in template ` apidocs ` is the template for generate website [ apidocs] ( https:// github.com/ alovn/apidocs) .
49
49
50
50
You can also use the custom template:
51
51
@@ -58,7 +58,7 @@ apidocgen \
58
58
59
59
## How to use
60
60
61
- apidocgen supported any web frameworks. here are an example using gin .
61
+ apidocgen supported any web frameworks. here are an example using [ bytego ] ( https://github.com/gostack-labs/bytego ) .
62
62
63
63
1 . Add API annotations in main.go code:
64
64
@@ -69,7 +69,7 @@ apidocgen supported any web frameworks. here are an example using gin.
69
69
// @desc the api about users
70
70
// @baseurl /user
71
71
func main () {
72
- r := gin. Default ()
72
+ r := bytego. New ()
73
73
c := controller.NewController ()
74
74
// @group account
75
75
// @title Account
@@ -79,7 +79,7 @@ apidocgen supported any web frameworks. here are an example using gin.
79
79
account.POST (" /register" , c.Register )
80
80
account.POST (" /login" , c.Login )
81
81
}
82
- r.Run (" :8000" )
82
+ _ = r.Run (" :8000" )
83
83
}
84
84
```
85
85
@@ -95,12 +95,12 @@ apidocgen supported any web frameworks. here are an example using gin.
95
95
//@response 200 common.Response{code=0,msg="success",data=LoginResponse} "登录成功返回数据"
96
96
//@response 200 common.Response{code=10020,msg="password_error"} "密码错误"
97
97
//@author alovn
98
- func (c *Controller) Login(ctx *gin.Context ) {
98
+ func (c *Controller) Login(c *bytego.Ctx ) {
99
99
//bind LoginRequest
100
100
res := common.NewResponse(0, "success", &LoginResponse{
101
101
WelcomeMsg: "welcome",
102
102
})
103
- ctx .JSON(http.StatusOK, res)
103
+ c .JSON(http.StatusOK, res)
104
104
}
105
105
` ` `
106
106
0 commit comments