You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.go 944 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "github.com/astaxie/beego"
  4. "github.com/astaxie/beego/plugins/cors"
  5. "github.com/casbin/casbase/routers"
  6. )
  7. func main() {
  8. beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
  9. AllowOrigins: []string{"*"},
  10. AllowMethods: []string{"GET", "PUT", "PATCH"},
  11. AllowHeaders: []string{"Origin"},
  12. ExposeHeaders: []string{"Content-Length"},
  13. AllowCredentials: true,
  14. }))
  15. //beego.DelStaticPath("/static")
  16. beego.SetStaticPath("/static", "web/build/static")
  17. // https://studygolang.com/articles/2303
  18. beego.InsertFilter("/", beego.BeforeRouter, routers.TransparentStatic) // must has this for default page
  19. beego.InsertFilter("/*", beego.BeforeRouter, routers.TransparentStatic)
  20. beego.BConfig.WebConfig.Session.SessionProvider = "file"
  21. beego.BConfig.WebConfig.Session.SessionProviderConfig = "./tmp"
  22. beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 3600 * 24 * 365
  23. beego.Run()
  24. }

基于Casbin的开源AI领域知识库平台

Contributors (1)