20 Star 164 Fork 26

qiqi / orange

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
route.go 860 Bytes
一键复制 编辑 原始数据 按行查看 历史
qiqi 提交于 2021-06-16 15:15 . 调整脚手架结构
package tpl
var route = `package route
import (
"{{.projectName}}/http/controller"
"{{.projectName}}/http/middleware"
"gitee.com/zhucheer/orange/app"
)
type Route struct {
}
func (s *Route) ServeMux() {
commonGp := app.NewRouter("")
{
commonGp.GET("/", controller.Welcome)
commonGp.GET("/api", func(ctx *app.Context) error {
return ctx.ToJson(map[string]interface{}{"data": "orange framework"})
})
}
authGp := app.NewRouter("/auth", middleware.NewAuth())
{
authGp.ALL("/info", controller.AuthCheck)
}
}
// Register 服务注册器, 可以对业务服务进行初始化调用
func (s *Route) Register() {
}
`
var jobRoute = `package route
import (
"{{.projectName}}/http/controller"
"gitee.com/zhucheer/orange/app"
"time"
)
func (s *Route) JobDispatch() {
app.JobRun("showTime", controller.JobShowTime, 30*time.Second)
}
`
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhucheer/orange.git
git@gitee.com:zhucheer/orange.git
zhucheer
orange
orange
v0.5.16

搜索帮助

344bd9b3 5694891 D2dac590 5694891