route/vendor/github.com/go-serve/bindatafs/README.md

74 lines
2.0 KiB
Markdown
Raw Normal View History

# bindatafs [![Documentations][godoc-badge]][godoc] [![Travis CI results][travis-badge]][travis] [![Coverage Status][coveralls-badge]][coveralls]
[travis]: https://travis-ci.org/go-serve/bindatafs
[travis-badge]: https://api.travis-ci.org/go-serve/bindatafs.svg?branch=master
[godoc]: https://godoc.org/github.com/go-serve/bindatafs
[godoc-badge]: https://img.shields.io/badge/godoc-reference-5272B4.svg
[coveralls]: https://coveralls.io/github/go-restit/lzjson?branch=master
[coveralls-badge]: https://coveralls.io/repos/github/go-restit/lzjson/badge.svg?branch=master
[repository]: https://github.com/go-serve/bindatafs
[go-bindata]: https://github.com/jteeuwen/go-bindata
[http.FileServer]: https://golang.org/pkg/net/http/#FileServer
**bindatafs** helps to serve [go-bindata][go-bindata]-generated assets with
[http.FileServer][http.FileServer].
## Install
```
go get -u github.com/go-serve/bindatafs
```
## Example
```go
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][godoc].
## Author
This software is written by [Koala Yeung](https://github.com/yookoala) (koalay at gmail.com).
## Licence
This software is licenced under the MIT License. You may obtain a copy of the
licence in the [LICENSE.md][LICENSE.md] file in this repository.
[LICENSE.md]: LICENSE.md
## Contributing and Bug Report
Pull requests are welcomed. Please read the [CONTRIBUTING.md][CONTRIBUTING.md]
for details.
Bug reports are always welcome to our [issue tracker][issues].
[CONTRIBUTING.md]: CONTRIBUTING.md
[issues]: https://github.com/go-serve/goserve/issues