允许uayu
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"sun-panel/router/panel"
|
||||
"sun-panel/router/system"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -15,7 +16,14 @@ func InitRouters(addr string) error {
|
||||
router := gin.Default()
|
||||
rootRouter := router.Group("/")
|
||||
routerGroup := rootRouter.Group("api")
|
||||
|
||||
router.Use(cors.New(cors.Config{
|
||||
// 允许所有源
|
||||
AllowOrigins: []string{"*"},
|
||||
// 允许所有方法
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
// 允许所有标头
|
||||
AllowHeaders: []string{"*"},
|
||||
}))
|
||||
// 接口
|
||||
system.Init(routerGroup)
|
||||
panel.Init(routerGroup)
|
||||
|
||||
Reference in New Issue
Block a user