SHARE
TWEET

Untitled

a guest Jun 18th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package auth
  2. ...
  3. auth = route.Group("/auth"){
  4.     auth.GET(...
  5.     auth.POST(...
  6. }
  7. ...
  8.  
  9. package users
  10. ...
  11. user = route.Group("/user"){
  12.     user.GET(...
  13.     user.POST(...
  14. }
  15. ...
  16.  
  17. package main
  18. import (
  19.      "auth"
  20.      "users"
  21. )
  22. ...
  23. router = gin.Default()
  24. router.Register(auth.auth, users.user)
  25. router.Run()
  26. ...
  27.      
  28. package auth
  29. import "...gin"
  30. func Routes(route *gin.Engine)
  31. auth := route.Group("/auth"){
  32.     auth.GET(...
  33.     auth.POST(...
  34. }
  35. ...
  36.  
  37. package users
  38. import "...gin"
  39. func Routes(route *gin.Engine)
  40. user := route.Group("/user"){
  41.     user.GET(...
  42.     user.POST(...
  43. }
  44. ...
  45.  
  46. package main
  47. import (
  48.      "github.com/username/package/sub/auth"
  49.      "github.com/username/package/sub/users"
  50.      "github.com/gin-gonic/gin"
  51. )
  52. ...
  53. router := gin.Default()
  54. auth.Routes(router) //Added all auth routes
  55. user.Routes(router) //Added all user routes
  56. router.Run()
  57. ...
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top