12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package routers
- import (
- "github.com/astaxie/beego"
- "github.com/astaxie/beego/plugins/cors"
- "hongze/hongze_api/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("/api",
- beego.NSNamespace("/home",
- beego.NSInclude(
- &controllers.HomeController{},
- ),
- beego.NSInclude(
- &controllers.HomeCommonController{},
- ),
- ),
- beego.NSNamespace("/report",
- beego.NSInclude(
- &controllers.ReportController{},
- ),
- beego.NSInclude(
- &controllers.ReportShareController{},
- ),
- ),
- beego.NSNamespace("/classify",
- beego.NSInclude(
- &controllers.ClassifyController{},
- ),
- beego.NSInclude(
- &controllers.ClassifyCommonController{},
- ),
- ),
- beego.NSNamespace("/wechat",
- beego.NSInclude(
- &controllers.WechatController{},
- ),
- beego.NSInclude(
- &controllers.WechatCommonController{},
- ),
- ),
- beego.NSNamespace("/user",
- beego.NSInclude(
- &controllers.UserController{},
- ),
- beego.NSInclude(
- &controllers.UserCommonController{},
- ),
- ),
- beego.NSNamespace("/video",
- beego.NSInclude(
- &controllers.VideoController{},
- ),
- ),
- )
- beego.AddNamespace(ns)
- }
|