lugolang / static

lu static file serving middleware, based on fasthttp.FS.
MIT License
2 stars 0 forks source link

index.html #1

Open vincentLiuxiang opened 8 years ago

vincentLiuxiang commented 8 years ago
func New(path string) func(ctx *fasthttp.RequestCtx, next func(error)) {
    fs := &fasthttp.FS{
        Root:       os.Getenv("GOPATH") + path,
        IndexNames: []string{"index.html"}, //  i think `index.html` should open to user
    }
        ....
}

IndexNames should open to user, just like: Static := static.New("/src/octopus-open/dist/","index.html")

vincentLiuxiang commented 8 years ago

moreover, I think you should check if the system has set env GOPATH, or you can't get os.Getenv("GOPATH").

eg:

gopath := os.Getenv("GOPATH")

if gopath == "" {
  panic(`System doesn't set env GOPATH, please set the env variable`)
  return
}
zhuqiuyang commented 8 years ago

@vincentLiuxiang Yes,you say right, i will add it .