Constructs a new route from a string specifcation. Specifcations are of the form ANCHOR=VALUE.
(s string, notfound []string)
| 95 | // Constructs a new route from a string specifcation. Specifcations are of the |
| 96 | // form ANCHOR=VALUE. |
| 97 | func newRoute(s string, notfound []string) (*Route, error) { |
| 98 | rp, err := routespec.ParseRouteSpec(s) |
| 99 | if err != nil { |
| 100 | return nil, err |
| 101 | } |
| 102 | |
| 103 | var ep endpoint |
| 104 | |
| 105 | if rp.IsURL { |
| 106 | ep, err = newForwardEndpoint(rp.Value) |
| 107 | } else { |
| 108 | ep, err = newFilesystemEndpoint(rp.Value, notfound) |
| 109 | } |
| 110 | if err != nil { |
| 111 | return nil, err |
| 112 | } |
| 113 | return &Route{rp.Host, rp.Path, ep}, nil |
| 114 | } |
| 115 | |
| 116 | // MuxMatch produces a match clause suitable for passing to a Mux |
| 117 | func (f Route) MuxMatch() string { |