Skip to content

go-serve/bindatafs

Repository files navigation

bindatafs

Documentations GitHub Workflow results Go Report Card 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.

About

Extends assets generated by go-bindata

Resources

License

Stars

Watchers

Forks

Packages

No packages published