mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 19:40:19 +08:00
Serve static files in Go.
This commit is contained in:
7
main.go
7
main.go
@ -18,6 +18,7 @@ import (
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/plugins/cors"
|
||||
"github.com/casdoor/casdoor/object"
|
||||
"github.com/casdoor/casdoor/routers"
|
||||
|
||||
_ "github.com/casdoor/casdoor/routers"
|
||||
)
|
||||
@ -33,6 +34,12 @@ func main() {
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
|
||||
//beego.DelStaticPath("/static")
|
||||
beego.SetStaticPath("/static", "web/build/static")
|
||||
// https://studygolang.com/articles/2303
|
||||
beego.InsertFilter("/", beego.BeforeRouter, routers.TransparentStatic) // must has this for default page
|
||||
beego.InsertFilter("/*", beego.BeforeRouter, routers.TransparentStatic)
|
||||
|
||||
beego.BConfig.WebConfig.Session.SessionProvider="file"
|
||||
beego.BConfig.WebConfig.Session.SessionProviderConfig = "./tmp"
|
||||
beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 3600 * 24 * 365
|
||||
|
Reference in New Issue
Block a user