12345678910111213141516171819202122232425262728293031323334 |
- // @APIVersion 1.0.0
- // @Title beego Test API
- // @Description beego has a very cool tools to autogenerate documents for your API
- // @Contact astaxie@gmail.com
- // @TermsOfServiceUrl http://beego.me/
- // @License Apache 2.0
- // @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
- package routers
- import (
- "github.com/beego/beego/v2/server/web"
- "github.com/beego/beego/v2/server/web/filter/cors"
- "hongze/hongze_mfyx_gzh/controllers"
- )
- func init() {
- web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
- AllowAllOrigins: true,
- AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
- AllowHeaders: []string{"Origin", "Account", "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", "Sign"},
- AllowCredentials: true,
- }))
- ns := web.NewNamespace("/api",
- web.NSNamespace("/wechat",
- web.NSInclude(
- &controllers.WechatController{},
- &controllers.WechatCommonController{},
- ),
- ),
- )
- web.AddNamespace(ns)
- }
|