()
| 19 | } |
| 20 | |
| 21 | func serveHTTP() { |
| 22 | gin.SetMode(gin.ReleaseMode) |
| 23 | |
| 24 | router := gin.Default() |
| 25 | router.Use(CORSMiddleware()) |
| 26 | |
| 27 | if _, err := os.Stat("./web"); !os.IsNotExist(err) { |
| 28 | router.LoadHTMLGlob("web/templates/*") |
| 29 | router.GET("/", HTTPAPIServerIndex) |
| 30 | router.GET("/stream/player/:uuid", HTTPAPIServerStreamPlayer) |
| 31 | } |
| 32 | router.POST("/stream/receiver/:uuid", HTTPAPIServerStreamWebRTC) |
| 33 | router.GET("/stream/codec/:uuid", HTTPAPIServerStreamCodec) |
| 34 | router.POST("/stream", HTTPAPIServerStreamWebRTC2) |
| 35 | |
| 36 | router.StaticFS("/static", http.Dir("web/static")) |
| 37 | err := router.Run(Config.Server.HTTPPort) |
| 38 | if err != nil { |
| 39 | log.Fatalln("Start HTTP Server error", err) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | //HTTPAPIServerIndex index |
| 44 | func HTTPAPIServerIndex(c *gin.Context) { |
no test coverage detected