允许跨域

This commit is contained in:
Shikong 2023-03-16 11:24:27 +08:00
parent d41136c22f
commit 4051173743
2 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/spf13/viper" "github.com/spf13/viper"
"matrix-middle-service/internel/middleware"
"matrix-middle-service/internel/route" "matrix-middle-service/internel/route"
"matrix-middle-service/pkg/config" "matrix-middle-service/pkg/config"
"matrix-middle-service/pkg/database" "matrix-middle-service/pkg/database"
@ -43,6 +44,7 @@ func Run() {
// 创建 fiber 服务器 // 创建 fiber 服务器
app = CreateApp(conf) app = CreateApp(conf)
middleware.UseCorsMiddleWare(app)
// 设置路由 // 设置路由
route.SetupRoute(app, conf) route.SetupRoute(app, conf)

View File

@ -11,7 +11,6 @@ func SetupRoute(app *fiber.App, conf *config.Conf) {
if conf.Server.EnableSwag { if conf.Server.EnableSwag {
SwaggerHandler(app) SwaggerHandler(app)
} }
bot.SetupBotController(app) bot.SetupBotController(app)
record.SetupRecordController(app) record.SetupRecordController(app)
} }