0

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.

Vijay Kumar
  • 597
  • 2
  • 8
  • 27

1 Answers1

0

This is an example I found using Beego Framework. Hope this helps.

Link to example Code

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")
}
kwtucker
  • 36
  • 4