go-platform/main.go

26 lines
558 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/routers"
"server/version"
beego "github.com/beego/beego/v2/server/web"
)
func main() {
// 初始化数据库
models.Init(version.Version)
// 启用请求体复制(允许多次读取请求体)
beego.BConfig.CopyRequestBody = true
// 设置最大请求体大小10MB足够登录请求使用
beego.BConfig.MaxMemory = 10 << 20 // 10MB
// 静态资源:映射 /uploads 到本地 uploads 目录,供前端访问上传文件
beego.SetStaticPath("/uploads", "uploads")
beego.Run()
}