+backend
+frontend empty
This commit is contained in:
parent
54a47c8a95
commit
b1745ede2e
59 changed files with 1197 additions and 13 deletions
56
backend/webapp.go
Normal file
56
backend/webapp.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
scribble "github.com/nanobox-io/golang-scribble"
|
||||
)
|
||||
|
||||
type Webapp struct {
|
||||
Engine *gin.Engine
|
||||
Stream *PriorityStream
|
||||
DB *scribble.Driver
|
||||
}
|
||||
|
||||
const _MaxLen = 8
|
||||
|
||||
func InitHttp(d *scribble.Driver) *Webapp {
|
||||
|
||||
router := gin.Default()
|
||||
router.Use(cors.Default())
|
||||
|
||||
wapp := &Webapp{
|
||||
Engine: router,
|
||||
DB: d,
|
||||
}
|
||||
|
||||
wapp.initApi()
|
||||
// wapp.initAuth()
|
||||
|
||||
display := router.Group("/display")
|
||||
display.Static("/", "./static/display")
|
||||
|
||||
video := router.Group("/videowall")
|
||||
video.Static("/", "./static/videowall")
|
||||
|
||||
priority := router.Group("/priority")
|
||||
priority.Static("/", "./static/priority")
|
||||
|
||||
sapp := router.Group("/_app")
|
||||
sapp.Static("/", "./static/_app")
|
||||
|
||||
static := router.Group("/static")
|
||||
static.Static("/", "./static/static")
|
||||
|
||||
router.StaticFile("/", "./static/index.html")
|
||||
router.StaticFile("/favicon.png", "./static/favicon.png")
|
||||
|
||||
router.ForwardedByClientIP = true
|
||||
router.SetTrustedProxies([]string{"127.0.0.1"})
|
||||
|
||||
log.Printf("WebApp: %+v", wapp)
|
||||
|
||||
return wapp
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue