本文整理汇总了Golang中github.com/astaxie/beego.AutoRouter函数的典型用法代码示例。如果您正苦于以下问题:Golang AutoRouter函数的具体用法?Golang AutoRouter怎么用?Golang AutoRouter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AutoRouter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
models.Init()
jobs.InitJobs()
// 设置默认404页面
beego.Errorhandler("404", func(rw http.ResponseWriter, r *http.Request) {
t, _ := template.New("404.html").ParseFiles(beego.ViewsPath + "/error/404.html")
data := make(map[string]interface{})
data["content"] = "page not found"
t.Execute(rw, data)
})
// 生产环境不输出debug日志
if beego.AppConfig.String("runmode") == "prod" {
beego.SetLevel(beego.LevelInformational)
}
beego.AppConfig.Set("version", VERSION)
// 路由设置
beego.Router("/", &controllers.MainController{}, "*:Index")
beego.Router("/login", &controllers.MainController{}, "*:Login")
beego.Router("/logout", &controllers.MainController{}, "*:Logout")
beego.Router("/profile", &controllers.MainController{}, "*:Profile")
beego.Router("/gettime", &controllers.MainController{}, "*:GetTime")
beego.Router("/help", &controllers.HelpController{}, "*:Index")
beego.AutoRouter(&controllers.TaskController{})
beego.AutoRouter(&controllers.GroupController{})
beego.SessionOn = true
beego.Run()
}
开发者ID:wuwenbao,项目名称:webcron,代码行数:31,代码来源:main.go
示例2: Init
func Init() {
//APP段接口
beego.AutoRouter(&api.UserController{})
beego.AutoRouter(&api.ArticleController{})
//后台
beego.Router("/admin", &admin.IndexController{}, "*:Index")
beego.Router("/admin/login", &admin.AccountController{}, "*:Login")
beego.Router("/admin/logout", &admin.AccountController{}, "*:Logout")
beego.Router("/admin/account/profile", &admin.AccountController{}, "*:Profile")
//用户管理
beego.Router("/admin/user/list", &admin.UserController{}, "*:List")
beego.Router("/admin/user/add", &admin.UserController{}, "*:Add")
beego.Router("/admin/user/edit", &admin.UserController{}, "*:Edit")
beego.Router("/admin/user/delete", &admin.UserController{}, "*:Delete")
//内容管理
beego.Router("/admin/article/add", &admin.ArticleController{}, "*:Add")
beego.Router("/admin/article/upload", &admin.ArticleController{}, "*:Upload")
beego.Router("/admin/article/save", &admin.ArticleController{}, "post:Save")
beego.Router("/admin/article/delete", &admin.ArticleController{}, "*:Delete")
beego.Router("/admin/article/batch", &admin.ArticleController{}, "*:Batch")
beego.Router("/admin/article/list", &admin.ArticleController{}, "*:List")
beego.Router("/admin/article/trash", &admin.ArticleController{}, "*:Trash")
beego.Router("/admin/article/edit", &admin.ArticleController{}, "*:Edit")
beego.Router("/admin/article/destroy", &admin.ArticleController{}, "*:Destroy")
beego.Router("/admin/tag/list", &admin.TagController{}, "*:List")
beego.Router("/admin/tag/delete", &admin.TagController{}, "*:Delete")
beego.Router("/admin/tag/add", &admin.TagController{}, "*:Add")
}
开发者ID:gezhixin,项目名称:goBlog,代码行数:32,代码来源:router.go
示例3: main
func main() {
orm.Debug = true
orm.RunSyncdb("default", false, true)
beego.Router("/", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/category", &controllers.CategoryController{})
beego.Router("/reply", &controllers.ReplyController{})
beego.AutoRouter(&controllers.ReplyController{})
beego.Router("/topic", &controllers.TopicController{})
beego.AutoRouter(&controllers.TopicController{})
os.Mkdir("attachment", os.ModePerm)
beego.SetStaticPath("/attachment", "attachment")
err := i18n.SetMessage("en-US", "conf/locale_en-US.ini")
if err != nil {
beego.Error(err)
}
err = i18n.SetMessage("zh-CN", "conf/locale_zh-CN.ini")
if err != nil {
beego.Error(err)
}
err = i18n.SetMessage("zh-HK", "conf/locale_zh-HK.ini")
if err != nil {
beego.Error(err)
}
beego.AddFuncMap("i18n", i18n.Tr)
beego.Run()
}
开发者ID:xuzhenglun,项目名称:Blog-Go,代码行数:32,代码来源:main.go
示例4: init
func init() {
// 注册数据库
models.RegisterDB()
/*
注册 beego 固定路由
*/
/*
如下所示的路由就是我们最常用的路由方式,一个固定的路由,一个控制器,然后根据用户请求方法不同请求控制器中对应的方法,典型的 RESTful 方式。
*/
/*
除了前缀两个/:controller/:method的匹配之外,剩下的 url beego会帮你自动化解析为参数,保存在 this.Ctx.Input.Params 当中:
object/blog/2013/09/12 调用 ObjectController 中的 Blog 方法,参数如下:map[0:2013 1:09 2:12]
*/
/*
现在已经可以通过自动识别出来下面类似的所有url,都会把请求分发到 controller 的 simple 方法:
/controller/simple
/controller/simple.html
/controller/simple.json
/controller/simple.rss
可以通过 this.Ctx.Input.Param(":ext") 获取后缀名。
*/
beego.Router("/", &controllers.HomeController{})
beego.Router("/home", &controllers.HomeController{})
beego.Router("/category", &controllers.CategoryController{})
beego.Router("/topic", &controllers.TopicController{})
beego.Router("/user", &controllers.UserController{})
beego.Router("/reply", &controllers.ReplyController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/load", &controllers.HomeController{}, "get:Load")
beego.Router("/home/load", &controllers.HomeController{}, "get:Load")
beego.Router("/category/load", &controllers.CategoryController{}, "get:Load")
beego.Router("/category/delete", &controllers.CategoryController{}, "get:Delete")
beego.Router("/reply/add", &controllers.ReplyController{}, "post:Add")
beego.Router("/reply/delete", &controllers.ReplyController{}, "get:Delete")
beego.Router("/attachment/:all", &controllers.AttachController{})
/*
智能路由
*/
/*
有了这个AutoRouter,便不需要像以前那样逐一注册了,访问/user/add 调用UserController的Add方法,访问/page/about调用PageController的About方法。
*/
beego.AutoRouter(&controllers.UserController{})
beego.AutoRouter(&controllers.TopicController{})
beego.Router("/topic/load", &controllers.TopicController{}, "get:Load")
beego.Router("/user/load", &controllers.UserController{}, "get:Load")
beego.Router("/topic/loadModify", &controllers.TopicController{}, "get:LoadModify")
beego.Router("/topic/loadView", &controllers.TopicController{}, "get:LoadView")
beego.Router("/user/loadModify", &controllers.UserController{}, "get:LoadModify")
beego.Router("/user/loadView", &controllers.UserController{}, "get:LoadView")
}
开发者ID:hopehook,项目名称:beegoblog,代码行数:59,代码来源:router.go
示例5: init
func init() {
beego.Router("/index", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.AutoRouter(&controllers.MainController{})
beego.AutoRouter(&controllers.ConfigController{})
beego.StaticDir["/static"] = "static"
}
开发者ID:xieao,项目名称:blog,代码行数:8,代码来源:router.go
示例6: init
func init() {
//默认路由
beego.Router("/", &controllers.MainController{})
//用户操作
//beego.Router("/Login", &controllers.UserController{}, "*:Login")
beego.AutoRouter(&controllers.UserController{})
beego.AutoRouter(&controllers.ProductController{})
}
开发者ID:ChengHanTrue,项目名称:ChWorld,代码行数:8,代码来源:router.go
示例7: init
func init() {
beego.InsertFilter("/main", beego.BeforeRouter, FilterUser)
//beego.Router("/", &controllers.MainController{})
beego.Router("/", &controllers.LoginController{})
beego.Router("/login", &controllers.LoginController{})
beego.AutoRouter(&controllers.LoginController{})
beego.Router("/main", &controllers.MainController{})
beego.AutoRouter(&controllers.MainController{})
}
开发者ID:kebikeyi,项目名称:GoodsManage,代码行数:9,代码来源:router.go
示例8: init
func init() {
beego.Router("/", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/category", &controllers.CategoryController{})
beego.Router("/topic", &controllers.TopicController{})
beego.AutoRouter(&controllers.TopicController{})
beego.AutoRouter(&controllers.ReplyController{})
beego.AutoRouter(&controllers.CategoryController{})
}
开发者ID:jango2015,项目名称:BeegoBlog,代码行数:9,代码来源:router.go
示例9: init
func init() {
beego.Router("/", &controllers.IndexController{}, "*:Index")
//beego.Router("/user", &controllers.UserController{})
//beego.Router("/user/index", &controllers.UserController{}, "*:Index")
beego.AutoRouter(&controllers.UserController{})
beego.AutoRouter(&controllers.LoginController{})
beego.AutoRouter(&controllers.IndexController{})
beego.AutoRouter(&controllers.AccessController{})
//beego.Router("/user/Get", &controllers.UserController{})
}
开发者ID:wuxinchaliu,项目名称:go-workadmin,代码行数:10,代码来源:router.go
示例10: main
func main() {
beego.Router("/", &controllers.MainController{}, "*:Index")
beego.AutoRouter(&controllers.IndexController{})
beego.AutoRouter(&controllers.MainController{})
beego.AutoRouter(&controllers.CategoryController{})
beego.AutoRouter(&controllers.MenuController{})
beego.AutoRouter(&controllers.UserController{})
beego.AddFuncMap("hex", hex)
beego.Run()
}
开发者ID:trigrass2,项目名称:crm,代码行数:10,代码来源:main.go
示例11: init
func init() {
beego.Router("/", &controllers.HomeController{})
beego.Router("/captcha", &controllers.UserController{}, "get:NewCaptcha") //验证码
beego.Router("/login", &controllers.UserController{}, "get:Login") //用户登录页
beego.Router("/login", &controllers.UserController{}, "post:LoginAction") //用户登录Action
beego.Router("/logout", &controllers.UserController{}, "get:Logout") //用户退出
beego.Router("/register", &controllers.UserController{}, "get:Register") //用户注册页面
beego.Router("/register", &controllers.UserController{}, "post:RegisterAction") //用户注册Action
beego.Router("/getpwd", &controllers.UserController{}, "get:GetPwd") //密码找回页
beego.Router("/getpwd", &controllers.UserController{}, "post:GetPwdAction") //密码找回Action
beego.Router("/modifypwd", &controllers.UserController{}, "get:ModifyPWD") //密码找回修改密码页
beego.Router("/modifypwd", &controllers.UserController{}, "post:ModifyPWDAction") //密码找回修改密码Action
beego.Router("/user/delete/:id:int", &controllers.UserController{}, "get:DeleteUser") //删除用户
beego.Router("/user/view/:username:string", &controllers.UserController{}, "get:GetUserInfo") //获取用户详情
beego.Router("/topic", &controllers.TopicController{})
beego.Router("/topic/add", &controllers.TopicController{}, "post:AddTopic") //发表文章
beego.Router("/topic/view/:id:int", &controllers.TopicController{}, "get:ViewTopic") //查看文章
beego.Router("/topic/view/:category:string", &controllers.TopicController{}, "get:ViewTopicByCategoryName") //根据文章查看文章列表
beego.Router("/topic/delete/:id:int", &controllers.TopicController{}, "get:DeleteTopic") //删除文章
beego.Router("/topic/modify/:id:int", &controllers.TopicController{}, "get:ModifyTopic") //修改文章页
beego.Router("/topic/modify/:id:int", &controllers.TopicController{}, "post:ModifyTopicAction") //修改文章Action
beego.AutoRouter(&controllers.TopicController{})
beego.Router("/category", &controllers.CategoryController{}, "get:GetAllCategory") //获取所有的分类
beego.Router("/category/add", &controllers.CategoryController{}, "post:AddCategory") //添加文章分类
beego.Router("/category/modify", &controllers.CategoryController{}, "post:ModifyCategory") //修改文章分类
beego.Router("/category/delete/:id:int", &controllers.CategoryController{}, "get:DeleteCategory") //删除文章分类
beego.AutoRouter(&controllers.CategoryController{})
}
开发者ID:a648132694,项目名称:goblog,代码行数:54,代码来源:router.go
示例12: init
func init() {
beego.Router("/", &controllers.HomeController{})
beego.Router("/adminlogin", &controllers.AdminLoginController{})
beego.Router("/adminhome", &controllers.AdminHomeController{})
beego.Router("/admincategory", &controllers.AdminCategoryController{})
beego.Router("/admintopic", &controllers.AdminTopicController{})
beego.Router("/topic", &controllers.TopicController{})
beego.Router("/category", &controllers.CategoryController{})
beego.AutoRouter(&controllers.TopicController{})
beego.AutoRouter(&controllers.AdminTopicController{})
}
开发者ID:Everything2014,项目名称:blog,代码行数:11,代码来源:router.go
示例13: init
func init() {
beego.AutoRouter(&controllers.TopicController{})
//自动路由只能匹配到/<controller>/<method>...,仅有/<controller>,自动路由如法匹配到
beego.Router("/topic", &controllers.TopicController{})
beego.Router("/", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/category", &controllers.CategoryController{})
beego.AutoRouter(&controllers.ReplyController{})
beego.Router("/reply", &controllers.ReplyController{})
//beego.Router("/reply/add", &controllers.ReplyController{}, "post:Add")
//beego.Router("/reply/delete", &controllers.ReplyController{}, "post:Add")
}
开发者ID:YanGeng,项目名称:Beeblog,代码行数:12,代码来源:router.go
示例14: init
func init() {
beego.Router("/", &controllers.MainController{})
beego.Router("/hello", &controllers.HelloController{})
beego.Router("/admin", &admin.AdminController{})
beego.Router("/admin/info", &admin.AdminController{}, "get:Info") //"*:Info"
beego.AutoRouter(&controllers.AutoController{})
}
开发者ID:qiangmzsx,项目名称:golang,代码行数:7,代码来源:router.go
示例15: init
func init() {
beego.Router("/", &controllers.MainController{})
beego.AutoRouter(&controllers.PointController{})
beego.Router("/point/SavePoints", &controllers.PointController{}, "post:SavePoints")
beego.Router("/point/GetTypeList", &controllers.PointController{}, "get:GetTypeList")
beego.Router("/point/GetWeekPointsJson/:id", &controllers.PointController{}, "get:GetWeekPointsJson")
}
开发者ID:zengcheng,项目名称:sfs,代码行数:7,代码来源:router.go
示例16: init
func init() {
beego.Router("/", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/whois", &controllers.WhoisController{})
beego.AutoRouter(&controllers.WhoisController{})
beego.Router("/plan", &controllers.PlanController{})
beego.Router("/srv", &controllers.SrvController{})
}
开发者ID:hetykai,项目名称:GetDomainWhois,代码行数:8,代码来源:router.go
示例17: init
func init() {
beego.Router("/", &controllers.IndexController{}, "get,post:Get")
beego.AutoRouter(&controllers.ClientController{})
beego.AutoRouter(&controllers.LoginController{})
beego.AutoRouter(&controllers.MessageController{})
/*
beego.Router("/", &controllers.IndexController{}, "get,post:Get")
beego.Router("/client/get", &controllers.ClientController{}, "get:Get")
beego.Router("/login/login", &controllers.LoginController{}, "post:Login")
beego.Router("/login/logout", &controllers.LoginController{}, "get:Logout")
beego.Router("/login/islogin", &controllers.LoginController{}, "get:Islogin")
beego.Router("/message/post", &controllers.MessageController{}, "post:Post")
beego.Router("/message/fetch", &controllers.MessageController{}, "get:Fetch")
beego.Router("/message/get", &controllers.MessageController{}, "get:Get")
beego.Router("/request/get", &controllers.RequestController{}, "get:Get")
*/
}
开发者ID:donnol,项目名称:BeeChat,代码行数:17,代码来源:router.go
示例18: init
func init() {
beego.Router("/", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/signup", &controllers.SignupController{})
beego.Router("/category", &controllers.CategoryController{})
beego.Router("/topic", &controllers.TopicController{})
beego.AutoRouter(&controllers.TopicController{})
beego.Router("/forgetpasswd", &controllers.ForgetPasswdController{})
}
开发者ID:danuxguin,项目名称:web4blog,代码行数:9,代码来源:router.go
示例19: init
func init() {
beego.Router("/", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/logout", &controllers.LogoutController{})
beego.Router("/catagory", &controllers.CatagoryController{})
beego.Router("/article", &controllers.ArticleController{})
beego.AutoRouter(&controllers.ArticleController{})
beego.Router("/about", &controllers.AboutController{})
}
开发者ID:hippora,项目名称:hippoblog,代码行数:9,代码来源:router.go
示例20: init
func init() {
beego.Router("/", &controllers.MainController{})
beego.Router("/login", &controllers.LoginController{})
beego.Router("/topic", &controllers.TopicController{})
beego.AutoRouter(&controllers.TopicController{})
beego.Router("/category", &controllers.CategoryController{})
beego.Router("/reply/add", &controllers.ReplyController{}, "post:Add")
beego.Router("/reply/del", &controllers.ReplyController{}, "get:Del")
}
开发者ID:Hevi-Ye,项目名称:blog,代码行数:9,代码来源:router.go
注:本文中的github.com/astaxie/beego.AutoRouter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论