bindatafs helps to serve go-bindata-generated assets with http.FileServer.
go get -u github.com/go-serve/bindatafs
package main
import (
"net/http"
"github.com/go-serve/bindatafs"
"golang.org/x/tools/godoc/vfs/httpfs"
)
// FileSystem returns a Filesystem implementation for the given assets
func FileSystem() bindatafs.FileSystem {
// assume you have Asset, AssetDir, AssetInfo are generated by go-bindata
return bindatafs.New("assets://", Asset, AssetDir, AssetInfo)
}
func main() {
handler := http.FileServer(httpfs.New(FileSystem()))
http.ListenAndServe(":8080", handler)
}
For more examples, please read the Documentations.
This software is written by Koala Yeung (koalay at gmail.com).
This software is licenced under the MIT License. You may obtain a copy of the licence in the LICENSE.md file in this repository.
Pull requests are welcomed. Please read the CONTRIBUTING.md for details.
Bug reports are always welcome to our issue tracker.