1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package vcweb 6 7 import ( 8 "log" 9 "net/http" 10 ) 11 12 // dirHandler is a vcsHandler that serves the raw contents of a directory. 13 type dirHandler struct{} 14 15 func (*dirHandler) Available() bool { return true } 16 17 func (*dirHandler) Handler(dir string, env []string, logger *log.Logger) (http.Handler, error) { 18 return http.FileServer(http.Dir(dir)), nil 19 } 20