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

Struct FileServer

fileserver/fileserver.go:233–240  ·  view source on GitHub ↗

FileServer returns a handler that serves HTTP requests with the contents of the file system rooted at root. To use the operating system's file system implementation, use http.Dir: http.Handle("/", &fileserver.FileServer{Root: http.Dir("/tmp")})

Source from the content-addressed store, hash-verified

231//
232// http.Handle("/", &fileserver.FileServer{Root: http.Dir("/tmp")})
233type FileServer struct {
234 Version string
235 Root http.FileSystem
236 Inject inject.CopyInject
237 Templates *template.Template
238 NotFoundRoutes []routespec.RouteSpec
239 Prefix string
240}
241
242func (fserver *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
243 fserver.ServeHTTPContext(context.Background(), w, r)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected