-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (33 loc) · 1.03 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 (
"github.com/astaxie/beego"
"runtime"
_ "secretBox/routers"
)
func getCurrentPath() string {
_, file, _, ok := runtime.Caller(1)
if !ok {
//panic(errors.New("Can not get current file info"))
return ""
}
return file
//dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
//if err != nil {
// beego.Debug(err)
//}
//return strings.Replace(dir, "\\", "/", -1)
}
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,
//}))
//fmt.Println(getCurrentPath(),"--")
//println(getCurrentPath())
beego.SetViewsPath("views")
beego.SetStaticPath("/static","./views/static/")
beego.Run()
}