3 Params
Lunny Xiao edited this page 4 years ago
  • Params Params let you access router’s matched parameters. “`Go 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.
```Go
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()
}