123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // @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/astaxie/beego"
- "github.com/astaxie/beego/plugins/cors"
- "hongze/hongze_admin/controllers"
- )
- 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("/admin",
- beego.NSNamespace("/sysuser",
- beego.NSInclude(
- &controllers.SysUserController{},
- ),
- beego.NSInclude(
- &controllers.SysUserAuthController{},
- ),
- ),
- beego.NSNamespace("/classify",
- beego.NSInclude(
- &controllers.ClassifyController{},
- ),
- ),
- beego.NSNamespace("/banner",
- beego.NSInclude(
- &controllers.BannerController{},
- ),
- ),
- beego.NSNamespace("/report",
- beego.NSInclude(
- &controllers.ReportController{},
- ),
- ),
- beego.NSNamespace("/voice",
- beego.NSInclude(
- &controllers.VoiceController{},
- ),
- ),
- beego.NSNamespace("/ppt",
- beego.NSInclude(
- &controllers.PptController{},
- ),
- ),
- beego.NSNamespace("/entry",
- beego.NSInclude(
- &controllers.TargetController{},
- ),
- ),
- )
- beego.AddNamespace(ns)
- }
|