说明: iris-framework 已经包含了 jwt 、xorm、gorm、mysql、godotenv、logrus,日志切割(每天)
func main() {
newApp()
}
func newApp() {
app := iris.New()
app.Use(Middleware.CORS) // 跨域设置
routes.Register(app) // 注册路由
app.HandleDir("/upload", "public/upload") // 设置静态资源
// 启动 app
app.Run(
iris.Addr(":" + os.Getenv("APP_PORT")),
iris.WithoutServerError(iris.ErrServerClosed),
iris.WithOptimizations,
)
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PFGZLFoI-1597280681710)(https://cdn.learnku.com/uploads/images/202007/30/28119/YMG59WILaz.png!large)]