I have a controller say XXController from package xx. Now i want this controller to be called as an function like xx.XXController{}. And the login inside controller should get executed.
1条回答 默认 最新
duan0414 2016-06-27 13:51关注This is an example I found using Beego Framework. Hope this helps.
package routers import ( "github.com/astaxie/beego" ctl "github.com/ikeikeikeike/beego-samples/auth/controllers" ) func init() { beego.Router("/", &ctl.UsersController{}, "get:Index") beego.Router("/login", &ctl.LoginController{}, "get,post:Login") beego.Router("/logout", &ctl.LoginController{}, "get:Logout") beego.Router("/signup", &ctl.LoginController{}, "get,post:Signup") }本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报