-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
42 lines (33 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
39
40
41
42
package main
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
"github.com/wkekai/goblog/models"
_ "github.com/wkekai/goblog/routers"
)
func init() {
models.Init()
}
func main() {
orm.Debug = false
beego.AddFuncMap("sub", sub)
beego.AddFuncMap("add", add)
logs.Async()
logs.SetLogger(logs.AdapterMultiFile, `{"filename": "logs/test.log", "daily": true}`)
// if runmode is dev use this
// if beego.BConfig.RunMode == "dev" {
// beego.BConfig.WebConfig.DirectoryIndex = true
// beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
// }
beego.Run()
}
func sub(in int) (out int) {
out = in - 1
return
}
func add(in int) (out int) {
out = in + 1
return
}