http urls monitor.

v1.go 598B

123456789101112131415161718192021222324252627
  1. package router
  2. import (
  3. "git.links123.net/links123.com/skeleton/cmd/http/handler"
  4. "git.links123.net/links123.com/skeleton/cmd/http/middleware"
  5. )
  6. func registerV1Router() {
  7. // All user can access
  8. v1NoAuth := r.Group("/v1")
  9. {
  10. v1NoAuth.GET("/hello", handler.Healthy)
  11. }
  12. // All user can access, you can get user id in handle
  13. v1OptionAuth := r.Group("/v1").Use(middleware.OptionalAuth())
  14. {
  15. v1OptionAuth.POST("/hello/option/auth", handler.Healthy)
  16. }
  17. // Only the login user can access
  18. v1Auth := r.Group("/v1").Use(middleware.Auth())
  19. {
  20. v1Auth.POST("/hello/auth", handler.Healthy)
  21. }
  22. }