You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
721 B

3 years ago
  1. package example_plugin
  2. import (
  3. "github.com/gin-gonic/gin"
  4. )
  5. var ExamplePlugin = new(pluginExample)
  6. type pluginExample struct{}
  7. func (*pluginExample) Register(group *gin.RouterGroup) {
  8. //如需细分权限 可以在此处use中间件 gva项目包名已改为github模式
  9. //所以整个plugin可以直接独立到外层开启为新的项目 然后用包的形式导入也是可以完整运行的
  10. // 例:
  11. /*
  12. group.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler()).GET("hello", func(context *gin.Context) {
  13. context.JSON(200, "hello world")
  14. })
  15. */
  16. group.GET("hello", func(context *gin.Context) {
  17. context.JSON(200, "hello world")
  18. })
  19. }
  20. func (*pluginExample) RouterPath() string {
  21. return "group"
  22. }