Skip to content

Gin middleware/handler for serving static files from binary data

License

Notifications You must be signed in to change notification settings

olebedev/staticbin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Gin middleware/handler for serving static files from binary data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages