File size: 866 Bytes
530729e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
package main
import (
"github.com/GoAdminGroup/go-admin/context"
"github.com/GoAdminGroup/go-admin/modules/auth"
c "github.com/GoAdminGroup/go-admin/modules/config"
"github.com/GoAdminGroup/go-admin/modules/db"
"github.com/GoAdminGroup/go-admin/modules/service"
"github.com/GoAdminGroup/go-admin/plugins"
)
type Example struct {
*plugins.Base
}
var Plugin = &Example{
Base: &plugins.Base{PlugName: "example"},
}
func (example *Example) InitPlugin(srv service.List) {
example.InitBase(srv, "example")
Plugin.App = example.initRouter(c.Prefix(), srv)
}
func (example *Example) initRouter(prefix string, srv service.List) *context.App {
app := context.NewApp()
route := app.Group(prefix)
route.GET("/example", auth.Middleware(db.GetConnection(srv)), example.TestHandler)
return app
}
func (example *Example) TestHandler(ctx *context.Context) {
}
|