Lunny Xiao edited this page Apr 7, 2015 · 3 revisions
  • Params Params let you access router's matched parameters.
type Action struct {
    tango.Params
}
func (a *Action) Get() string {
    return a.Params.Get(":name")
}

func main() {
    t := tango.Classic()
    t.Get("/:name", new(Action))
    t.Run()
}

For regexp parameters, also use :name` for named matches.

type Action struct {
    tango.Params
}
func (a *Action) Get() string {
    return a.Params.Get(":name")
}

func main() {
    t := tango.Classic()
    t.Post("/(:name.*)", new(Action))
    t.Run()
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.