Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 982 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 982 Bytes

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")
}