mirror of
https://github.com/gin-gonic/gin.git
synced 2026-09-07 08:52:04 +08:00
docs(router): document custom verb paths
Users following Google AIP-style APIs need examples for literal colon suffix routes. Add custom verb examples beside the existing path parameter routing documentation. The docs show both literal segment verbs and param-plus-verb routes.
This commit is contained in:
parent
6bc76c3404
commit
d9c5f2db0a
10
docs/doc.md
10
docs/doc.md
@ -171,6 +171,16 @@ func main() {
|
||||
c.String(http.StatusOK, "The available groups are [...]")
|
||||
})
|
||||
|
||||
// Gin also supports literal colon suffixes used by custom verbs, such as Google AIP-136.
|
||||
router.POST("/users:batchGet", func(c *gin.Context) {
|
||||
c.String(http.StatusOK, "batch get users")
|
||||
})
|
||||
|
||||
router.POST("/customers/:customerID:mutate", func(c *gin.Context) {
|
||||
customerID := c.Param("customerID")
|
||||
c.String(http.StatusOK, "mutate customer %s", customerID)
|
||||
})
|
||||
|
||||
router.Run(":8080")
|
||||
}
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user