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.
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.
收起
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")
}
报告相同问题?