MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / SetRouter

Function SetRouter

router/main.go:13–31  ·  view source on GitHub ↗
(router *gin.Engine, buildFS embed.FS, indexPage []byte)

Source from the content-addressed store, hash-verified

11)
12
13func SetRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
14 SetApiRouter(router)
15 SetDashboardRouter(router)
16 SetRelayRouter(router)
17 SetVideoRouter(router)
18 frontendBaseUrl := os.Getenv("FRONTEND_BASE_URL")
19 if common.IsMasterNode && frontendBaseUrl != "" {
20 frontendBaseUrl = ""
21 common.SysLog("FRONTEND_BASE_URL is ignored on master node")
22 }
23 if frontendBaseUrl == "" {
24 SetWebRouter(router, buildFS, indexPage)
25 } else {
26 frontendBaseUrl = strings.TrimSuffix(frontendBaseUrl, "/")
27 router.NoRoute(func(c *gin.Context) {
28 c.Redirect(http.StatusMovedPermanently, fmt.Sprintf("%s%s", frontendBaseUrl, c.Request.RequestURI))
29 })
30 }
31}

Callers 1

mainFunction · 0.92

Calls 6

SysLogFunction · 0.92
SetApiRouterFunction · 0.85
SetDashboardRouterFunction · 0.85
SetRelayRouterFunction · 0.85
SetVideoRouterFunction · 0.85
SetWebRouterFunction · 0.85

Tested by

no test coverage detected