|
@@ -9,12 +9,21 @@
|
|
|
package routers
|
|
|
|
|
|
import (
|
|
|
+ "github.com/astaxie/beego/plugins/cors"
|
|
|
"hongze/hongze_mobile_admin/controllers"
|
|
|
|
|
|
"github.com/astaxie/beego"
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
+ //解决跨域问题
|
|
|
+ beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
|
|
|
+ AllowAllOrigins: true,
|
|
|
+ AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
|
|
+ AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
|
|
|
+ ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
|
|
|
+ AllowCredentials: true,
|
|
|
+ }))
|
|
|
ns := beego.NewNamespace("/api",
|
|
|
beego.NSNamespace("/wechat",
|
|
|
beego.NSInclude(
|