作者 唐旭辉

调试

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