作者 唐旭辉

调试

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 config_name = "dev" 2 config_name = "dev"
3 #----beego的默认配置 开始--- 3 #----beego的默认配置 开始---
4 #端口号 4 #端口号
5 -httpport = 8080 5 +httpport = 8081
6 #开启应用内监控 6 #开启应用内监控
7 EnableAdmin = false 7 EnableAdmin = false
8 AdminPort = 8088 8 AdminPort = 8088
@@ -20,14 +20,14 @@ type BaseController struct { @@ -20,14 +20,14 @@ type BaseController struct {
20 20
21 //Prepare 实现beego.ControllerInterface 的接口 21 //Prepare 实现beego.ControllerInterface 的接口
22 func (this *BaseController) Prepare() { 22 func (this *BaseController) Prepare() {
23 - // this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")  
24 - // this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Headers", "*")  
25 - // if this.Ctx.Input.Method() == "OPTIONS" {  
26 - // this.Ctx.ResponseWriter.WriteHeader(204)  
27 - // this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")  
28 - // //this.Ctx.WriteString("")  
29 - // return  
30 - // } 23 + this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")
  24 + this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Headers", "*")
  25 + if this.Ctx.Input.Method() == "OPTIONS" {
  26 + this.Ctx.ResponseWriter.WriteHeader(204)
  27 + this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
  28 + //this.Ctx.WriteString("")
  29 + return
  30 + }
31 p := this.Ctx.Input.GetData("RouterPattern") 31 p := this.Ctx.Input.GetData("RouterPattern")
32 fmt.Println("====>r:", p) 32 fmt.Println("====>r:", p)
33 } 33 }