-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
38 lines (31 loc) · 772 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
32
33
34
35
36
37
38
package main
import (
"fmt"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
"github.com/joho/godotenv"
"github.com/melardev/GoBeegoApiCrudPagination/infrastructure"
_ "github.com/melardev/GoBeegoApiCrudPagination/routers"
"github.com/melardev/GoBeegoApiCrudPagination/seeds"
"os"
)
func main() {
e := godotenv.Load() // Load .env file
if e != nil {
fmt.Print(e)
os.Exit(0)
}
// if in develop mode
if beego.BConfig.RunMode == "dev" {
beego.BConfig.WebConfig.DirectoryIndex = true
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
}
if err := infrastructure.Initialize(); err != nil {
panic(err.Error())
}
seeds.Seed()
// Print SQL statements executed
orm.Debug = true
beego.Run()
}