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.
31 lines
614 B
31 lines
614 B
package example
|
|
|
|
import (
|
|
"github.com/flipped-aurora/gin-vue-admin/utils/plugin"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
var Plugin []plugin.Plugin = []plugin.Plugin{&PluginExample}
|
|
|
|
var PluginExample = pluginExample{}
|
|
|
|
type pluginExample struct {
|
|
}
|
|
|
|
func (*pluginExample) Register(group *gin.RouterGroup) {
|
|
group.GET("hello", func(context *gin.Context) {
|
|
context.JSON(200, "hello world")
|
|
})
|
|
}
|
|
|
|
func (*pluginExample) RouterPath() string {
|
|
return "group"
|
|
}
|
|
|
|
func PluginInit(group *gin.RouterGroup) {
|
|
for i := range Plugin {
|
|
PluginGroup := group.Group(Plugin[i].RouterPath())
|
|
Plugin[i].Register(PluginGroup)
|
|
}
|
|
}
|