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:
Kuroda Kayn 2026-06-28 15:21:37 +08:00
parent 6bc76c3404
commit d9c5f2db0a

View File

@ -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")
}
```