Merge pull request #200 from hqcchina/master
fix: Serve static javascript file with mime-type error
This commit is contained in:
1 file changed
+7
-3
+7
-3
@@ -1,9 +1,6 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
|
||||||
"github.com/swaggo/gin-swagger/swaggerFiles"
|
|
||||||
log2 "go-admin/apis/log"
|
log2 "go-admin/apis/log"
|
||||||
"go-admin/apis/monitor"
|
"go-admin/apis/monitor"
|
||||||
"go-admin/apis/public"
|
"go-admin/apis/public"
|
||||||
@@ -16,6 +13,11 @@ import (
|
|||||||
"go-admin/middleware"
|
"go-admin/middleware"
|
||||||
jwt "go-admin/pkg/jwtauth"
|
jwt "go-admin/pkg/jwtauth"
|
||||||
"go-admin/pkg/ws"
|
"go-admin/pkg/ws"
|
||||||
|
"mime"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
ginSwagger "github.com/swaggo/gin-swagger"
|
||||||
|
"github.com/swaggo/gin-swagger/swaggerFiles"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitSysRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.RouterGroup {
|
func InitSysRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.RouterGroup {
|
||||||
@@ -50,6 +52,8 @@ func sysBaseRouter(r *gin.RouterGroup) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sysStaticFileRouter(r *gin.RouterGroup) {
|
func sysStaticFileRouter(r *gin.RouterGroup) {
|
||||||
|
mime.AddExtensionType(".js", "application/javascript")
|
||||||
|
|
||||||
r.Static("/static", "./static")
|
r.Static("/static", "./static")
|
||||||
r.Static("/form-generator", "./static/form-generator")
|
r.Static("/form-generator", "./static/form-generator")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user