-
Notifications
You must be signed in to change notification settings - Fork 0
/
route.go
25 lines (20 loc) · 813 Bytes
/
route.go
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
package http
import (
"github.com/26huitailang/octopus/app/http/module/agent"
"github.com/26huitailang/octopus/app/http/module/demo"
"github.com/26huitailang/yogo/framework/contract"
"github.com/26huitailang/yogo/framework/gin"
ginSwagger "github.com/26huitailang/yogo/framework/middleware/gin-swagger"
"github.com/26huitailang/yogo/framework/middleware/gin-swagger/swaggerFiles"
"github.com/26huitailang/yogo/framework/middleware/static"
)
func Routes(r *gin.Engine) {
container := r.GetContainer()
configService := container.MustMake(contract.ConfigKey).(contract.Config)
r.Use(static.Serve("/", static.LocalFile("./dist", false)))
if configService.GetBool("app.swagger") == true {
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
}
demo.Register(r)
agent.Register(r)
}