1 Star 0 Fork 1

Neilyoz / goedu

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 611 Bytes
一键复制 编辑 原始数据 按行查看 历史
Neilyoz 提交于 2020-08-18 22:44 . 更新go.mod文件
package main
import (
"goedu/router"
"time"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
gin.SetMode(gin.DebugMode)
// cors 中间件
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"},
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: false,
MaxAge: 48 * time.Hour,
}))
// 绑定路由
r = router.SetupRouter(r)
_ = r.Run(":3000")
}
Go
1
https://gitee.com/neilyoz/goedu.git
git@gitee.com:neilyoz/goedu.git
neilyoz
goedu
goedu
master

搜索帮助