package router import ( "git.links123.net/links123.com/skeleton/cmd/http/handler" "git.links123.net/links123.com/skeleton/cmd/http/middleware" ) func registerV1Router() { // All user can access v1NoAuth := r.Group("/v1") { v1NoAuth.GET("/hello", handler.Healthy) } // All user can access, you can get user id in handle v1OptionAuth := r.Group("/v1").Use(middleware.OptionalAuth()) { v1OptionAuth.POST("/hello/option/auth", handler.Healthy) } // Only the login user can access v1Auth := r.Group("/v1").Use(middleware.Auth()) { v1Auth.POST("/hello/auth", handler.Healthy) } }