Add a route to the collection
(value string, notfound []string)
| 128 | |
| 129 | // Add a route to the collection |
| 130 | func (f RouteCollection) Add(value string, notfound []string) error { |
| 131 | s, err := newRoute(value, notfound) |
| 132 | if err != nil { |
| 133 | return err |
| 134 | } |
| 135 | if _, exists := f[s.MuxMatch()]; exists { |
| 136 | return errors.New("Route already exists.") |
| 137 | } |
| 138 | f[s.MuxMatch()] = *s |
| 139 | return nil |
| 140 | } |