forked from 3xxx/engineercms
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
31 lines (28 loc) · 961 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"os"
_ "github.com/3xxx/engineercms/routers"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/astaxie/beego/plugins/cors"
_ "github.com/mattn/go-sqlite3"
)
func main() {
//运行跨域请求
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
AllowAllOrigins: true,
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
AllowCredentials: true,
}))
//开启orm调试模式
orm.Debug = true
//创建附件目录
os.Mkdir("attachment", os.ModePerm)
//创建轮播图片存放目录
os.Mkdir("attachment//carousel", os.ModePerm)
//自动建表
orm.RunSyncdb("default", false, true)
beego.Run()
}