2025-10-29 23:07:53 +08:00

27 lines
626 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"server/models"
_ "server/models" // 确保菜单模型被正确导入
_ "server/routers"
beego "github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/server/web/context"
)
func main() {
// 初始化数据库
models.Init()
// CORS配置已移至router.go中统一管理
// 确保请求体被正确读取(包括 POST、PUT、PATCH
beego.InsertFilter("*", beego.BeforeRouter, func(ctx *context.Context) {
method := ctx.Input.Method()
if method == "PUT" || method == "POST" || method == "PATCH" {
ctx.Input.CopyBody(1024 * 1024) // 1MB 缓冲区
}
})
beego.Run()
}