Exemple #1
0
func main() {
	reg := urlregex.Pattern("some/:name/path/:other/")
	fmt.Println("regex: " + reg.Regex.String())

	res, err := reg.Match("some/123/path/456/")
	if err != nil {
		fmt.Println("no matches")
		return
	}

	fmt.Println("found matches")
	for k, v := range res {
		fmt.Println(k + ": " + v)
	}
}
Exemple #2
0
func (m *methods) add(path string, fn handler, method string) *Route {
	route := Route{&interceptor{[]appliable{}}, fn, urlregex.Pattern(path), nil}
	m.routes[method] = append(m.routes[method], route)

	return &route
}