package webserver import ( "strings" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" ) func (s *Server) setupRoute() { apiHandler := gin.New() groupV1 := apiHandler.Group("/api/v1") { groupV1. POST("/sdp", s.exchangeSDP). GET("/instruction", s.getInstruction). GET("/iceserver/url", s.getICEConfig). GET("/name", s.getName) } s.webServer.Use(func(ctx *gin.Context) { path := ctx.Request.RequestURI logrus.Debug(path) if strings.HasPrefix(path, "/api") { apiHandler.HandleContext(ctx) } else { staticFileHandler()(ctx) } }) }