Go lang index http.FileSystem
$ go get github.com/gnue/httpfs/indexfs
import "github.com/gnue/httpfs/indexfs"
package main
import (
"github.com/gnue/httpfs/indexfs"
"net/http"
)
func main() {
fs := indexfs.New(http.Dir("sites"), func(fs http.FileSystem, dir string) (http.File, error) {
return indexfs.OpenIndex(fs, dir, "index.html", "index.htm")
})
http.Handle("/", http.FileServer(fs))
http.ListenAndServe(":8080", nil)
}
Simple index webserver
indexes := indexfs.Indexes{"index.html", "index.htm"}
fs := indexfs.New(http.Dir("test"), indexes.DirIndex)
indexes := indexfs.Indexes{"index.html", "index.htm"}
fs := indexfs.New(http.Dir("test"), indexes.AutoIndex)