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

2.0 KiB

bindatafs Documentations Travis CI results Coverage Status

bindatafs helps to serve go-bindata-generated assets with http.FileServer.

Install

go get -u github.com/go-serve/bindatafs

Example


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.

Author

This software is written by Koala Yeung (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 file in this repository.

Contributing and Bug Report

Pull requests are welcomed. Please read the CONTRIBUTING.md for details.

Bug reports are always welcome to our issue tracker.