-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: improve route doc #361
Conversation
ed7ec4d
to
bcc689c
Compare
| `Hertz.PATCH` | 用于注册 HTTP Method 为 PATCH 的方法 | | ||
| `Hertz.HEAD` | 用于注册 HTTP Method 为 HEAD 的方法 | | ||
| `Hertz.OPTIONS` | 用于注册 HTTP Method 为 OPTIONS 的方法 | | ||
| `Hertz.Handle` | 这个方法支持用户手动传入 HTTP Method 用来注册方法,当用于注册普通的 HTTP Method 方法时和上述的方法作用是一致,但是这个方法同时支持用于注册自定义 HTTP Method 方法 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「是一致」->「是一致的」,这个方法同时也支持用于注册自定义 HTTP Method 方法。(感觉这样更通顺些?:D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GET
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bcc689c
to
9e1b1b2
Compare
|
||
### 使用匿名函数与装饰器注册路由 | ||
|
||
在使用匿名函数或装饰器注册路由时,如果我们需要使用 `RequestContext.HandlerName()` 获取 handler 名称会获取到错误的名称。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果我们需要使用 RequestContext.HandlerName()
获取 handler 名称会获取到错误的名称。 ->「如果我们使用RequestContext.HandlerName()
获取 handler 名称则会获取到错误的名称。」
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
Welcome CR and not merged for now |
9e1b1b2
to
fadf3f6
Compare
|
||
如果我们设置`/src/*filepath`路由,匹配情况如下 | ||
如果我们设置`/src/*path`路由,匹配情况如下 | ||
|
||
| path | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| path | | -> | 路径 | 是否匹配 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
507b813
to
0779207
Compare
|
||
### 获取路由注册信息 | ||
|
||
Hertz 提供了 `Routes` 获取注册的路由信息(http method、http path、handler name)供用户使用. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该使用中文标点符号,typo:使用. -> 使用。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
0779207
to
825754d
Compare
f6832bb
to
cba641c
Compare
// will registers a route that matches all the HTTP methods. | ||
h.Any("/ping_any", func(ctx context.Context, c *app.RequestContext) { | ||
c.String(consts.StatusOK,"any") | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 为啥只在这个注册方法加了注释,其它方法要不要也加呢?
- consts.StatusOK,"any" 少了空格
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉这个注释了
|
||
### 获取路由注册信息 | ||
|
||
Hertz 提供了 `Routes` 获取注册的路由信息(http method、http path、handler name)供用户使用。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 Routes 的结构体也贴一下吧,会清晰一些
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
6c3c59f
to
0a54cdc
Compare
0a54cdc
to
b0c510c
Compare
What type of PR is this?
doc
What this PR does / why we need it (en: English/zh: Chinese):
en: improve route doc
zh: 改善路由文档中文部分
Which issue(s) this PR fixes: