-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
41 lines (38 loc) · 1.15 KB
/
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
39
40
package main
import (
_ "solardatabase/routers"
"github.com/astaxie/beego"
// "solardatabase/dao"
"strconv"
"os"
"solardatabase/dao"
"fmt"
"solardatabase/models"
"github.com/astaxie/beego/plugins/cors"
)
func main() {
port, err := strconv.Atoi(os.Getenv("PORT"))
if err == nil {
beego.BConfig.Listen.HTTPPort = port
}
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "DELETE", "PUT", "PATCH", "POST"},
AllowHeaders: []string{"Origin"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
}))
beego.BConfig.RunMode = "dev"
beego.BConfig.WebConfig.AutoRender = false
beego.BConfig.WebConfig.TemplateLeft = "<<<"
beego.BConfig.WebConfig.TemplateRight = ">>>"
var dbUser = beego.AppConfig.String("dbuser")
var dbHost = beego.AppConfig.String("dbhost")
var dbName = beego.AppConfig.String("dbname")
var dbPass = beego.AppConfig.String("dbpass")
fmt.Printf("before type")
fmt.Println(models.Tvalue(models.T_GreaterThan))
fmt.Println(models.Svalue(models.S_Contains))
dao.OpenDBConnection(dbUser, dbHost, dbName, dbPass)
beego.Run()
}