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.

28 lines
723 B

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