package router
import (
"net/http"
"strings"
"github.com/gin-gonic/gin"
)
func frontendStaticRouter(router *gin.Engine) {
router.Static("./static", "../web/ismp-automation-web/static")
router.StaticFile("./", "../web/ismp-automation-web/index.html")
router.NoRoute(func(c *gin.Context) {
uri := c.Request.RequestURI
if strings.HasPrefix(uri, "/swagger") {
c.AbortWithStatus(http.StatusNotFound)
return
}
if !strings.HasPrefix(uri, "/automation/boltdog/openapi/v2") {
c.File("../web/ismp-automation-web/index.html")
return
}
c.AbortWithStatus(http.StatusNotFound)
})
}