路由

最后更新于:2022-04-02 02:47:59

[TOC] ## 路由 ### GET / POST / DELETE ``` router.GET("/someGet", getting) router.Any("/someGet", getting) router.POST("/somePost", posting) router.PUT("/somePut", putting) router.DELETE("/someDelete", deleting) router.PATCH("/somePatch", patching) router.HEAD("/someHead", head) router.OPTIONS("/someOptions", options) ``` ### Group 路由 ``` v1 := router.Group("/v1") { v1.GET("/login", loginEndpoint) v1.POST("/submit", submitEndpoint) v1.POST("/read", readEndpoint) } ``` ### 嵌套 group 路由 ``` v1 := router.Group("/v1") { v1.GET("/login", loginEndpoint) user := v1.Group("/user") { user.GET("/get", demo) } } ```
';