func (s *Static) ServeNext(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.Method != "GET" && r.Method != "HEAD" {
			next.ServeHTTP(w, r)
			return
		}
		file := r.URL.Path
		if s.Prefix != "" {
			if !strings.HasPrefix(file, s.Prefix) {
				next.ServeHTTP(w, r)
				return
			}
			file = file[len(s.Prefix):]
			if file != "" && file[0] != '/' {
				next.ServeHTTP(w, r)
				return
			}
		}
		f, err := s.Dir.Open(file)
		if err != nil {
			next.ServeHTTP(w, r)
			return
		}
		defer f.Close()
		fi, err := f.Stat()
		if err != nil {
			next.ServeHTTP(w, r)
			return
		}
		if fi.IsDir() {
			if !strings.HasSuffix(r.URL.Path, "/") {
				http.Redirect(w, r, r.URL.Path+"/", http.StatusFound)
				return
			}
			file = path.Join(file, s.IndexFile)
			f, err = s.Dir.Open(file)
			if err != nil {
				next.ServeHTTP(w, r)
				return
			}
			defer f.Close()
			fi, err = f.Stat()
			if err != nil || fi.IsDir() {
				next.ServeHTTP(w, r)
				return
			}
		}
		http.ServeContent(w, r, file, fi.ModTime(), f)
	})
}
ServeNext tries to find a file in the directory
package middleware
import (
	"net/http"
	"path"
	"strings"
	"github.com/celrenheit/lion"
)
type Static struct {
	Dir http.FileSystem
	Prefix string
	IndexFile string
}
func NewStatic(directory http.FileSystem) lion.Middleware {
	return &Static{
		Dir:       directory,
		Prefix:    "",
		IndexFile: "index.html",
	}
}