Skip to content
Gin middleware/handler for serving static files from binary data
Branch: master
Clone or download
olebedev
olebedev test fixes
Latest commit 588762e Feb 8, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore initial commit Jan 1, 2015
LICENSE initial commit Jan 1, 2015
README.md Update README.md Feb 8, 2015
static.go test fixes Feb 8, 2015
static_test.go initial commit Jan 1, 2015
wercker.yml add wercker Jan 1, 2015

README.md

StaticBin wercker status GoDoc

Gin middleware/handler for serving static files from binary data.

Usage

package main

import (
  "github.com/gin-gonic/gin"
  "github.com/olebedev/staticbin"
)

func main() {
  r := gin.New() // without any middlewares

  // Serves the "static" directory's files from binary data.
  // You have to pass the "Asset" function generated by
  // go-bindata (https://github.com/jteeuwen/go-bindata).
  r.Use(staticbin.Static(Asset, staticbin.Options{
    // Dir prefix will be trimmed. It needs to separate namespace.
    Dir: "/static",
  }))

  r.Get("/", func() string {
    return "Hello world!"
  })

  r.Run(":8080")
}
You can’t perform that action at this time.