Skip to content

Commit 396bfd3

Browse files
committed
docs: exmaples with bytego
1 parent 8910878 commit 396bfd3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Flags:
2222
--excludes: Exclude directories and files when searching, comma separated
2323
--output: Generate markdown files dir, default ./docs/
2424
--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.
2626
```
2727

2828
built-in templates include `markdown` and `apidocs`, default is `markdown`.
@@ -45,7 +45,7 @@ apidocgen \
4545

4646
The built-in includes `markdown` and `apidocs`.
4747

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).
4949

5050
You can also use the custom template:
5151

@@ -58,7 +58,7 @@ apidocgen \
5858

5959
## How to use
6060

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).
6262

6363
1. Add API annotations in main.go code:
6464

@@ -69,7 +69,7 @@ apidocgen supported any web frameworks. here are an example using gin.
6969
//@desc the api about users
7070
//@baseurl /user
7171
func main() {
72-
r := gin.Default()
72+
r := bytego.New()
7373
c := controller.NewController()
7474
//@group account
7575
//@title Account
@@ -79,7 +79,7 @@ apidocgen supported any web frameworks. here are an example using gin.
7979
account.POST("/register", c.Register)
8080
account.POST("/login", c.Login)
8181
}
82-
r.Run(":8000")
82+
_ = r.Run(":8000")
8383
}
8484
```
8585

@@ -95,12 +95,12 @@ apidocgen supported any web frameworks. here are an example using gin.
9595
//@response 200 common.Response{code=0,msg="success",data=LoginResponse} "登录成功返回数据"
9696
//@response 200 common.Response{code=10020,msg="password_error"} "密码错误"
9797
//@author alovn
98-
func (c *Controller) Login(ctx *gin.Context) {
98+
func (c *Controller) Login(c *bytego.Ctx) {
9999
//bind LoginRequest
100100
res := common.NewResponse(0, "success", &LoginResponse{
101101
WelcomeMsg: "welcome",
102102
})
103-
ctx.JSON(http.StatusOK, res)
103+
c.JSON(http.StatusOK, res)
104104
}
105105
```
106106

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Flags:
3333
--excludes: Exclude directories and files when searching, comma separated
3434
--output: Generate markdown files dir, default ./docs/
3535
--template: Template name or custom template directory, built-in includes markdown and apidocs, default markdown.
36-
--single: If true, generate a single markdown file, default false`)
36+
--single: Generate a single markdown file.`)
3737
return
3838
}
3939
g := gen.New(&gen.Config{

0 commit comments

Comments
 (0)