main.go 604 B

12345678910111213141516171819
  1. package main
  2. import (
  3. _ "cc-officialweb/routers"
  4. beego "github.com/beego/beego/v2/server/web"
  5. "github.com/beego/beego/v2/server/web/filter/cors"
  6. )
  7. func main() {
  8. beego.SetStaticPath("/image", "./static/upload")
  9. beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
  10. AllowAllOrigins: true,
  11. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  12. AllowHeaders: []string{"Origin", "Content-Type", "Authorization", "X-Requested-With"},
  13. ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin"},
  14. AllowCredentials: true,
  15. }))
  16. beego.Run()
  17. }