MCPcopy
hub / github.com/cortesi/devd / newFilesystemEndpoint

Function newFilesystemEndpoint

route.go:58–71  ·  view source on GitHub ↗
(path string, notfound []string)

Source from the content-addressed store, hash-verified

56}
57
58func newFilesystemEndpoint(path string, notfound []string) (*filesystemEndpoint, error) {
59 rparts := []routespec.RouteSpec{}
60 for _, p := range notfound {
61 rp, err := routespec.ParseRouteSpec(p)
62 if err != nil {
63 return nil, err
64 }
65 if rp.IsURL {
66 return nil, fmt.Errorf("Not found over-ride target cannot be a URL.")
67 }
68 rparts = append(rparts, *rp)
69 }
70 return &filesystemEndpoint{path, rparts}, nil
71}
72
73func (ep filesystemEndpoint) Handler(prefix string, templates *template.Template, ci inject.CopyInject) httpctx.Handler {
74 return &fileserver.FileServer{

Callers 4

tFilesystemEndpointFunction · 0.85
TestNotFoundFunction · 0.85
fsEndpointFunction · 0.85
newRouteFunction · 0.85

Calls

no outgoing calls

Tested by 3

tFilesystemEndpointFunction · 0.68
TestNotFoundFunction · 0.68
fsEndpointFunction · 0.68