1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

add support for embed.FS

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-09-19 01:15:38 +03:00
parent 71e8a14615
commit 414c1ad1ae
15 changed files with 179 additions and 22 deletions

View File

@@ -1,21 +1,19 @@
package main
import (
"embed"
"github.com/kataras/iris/v12"
)
// Follow these steps first:
// $ go install github.com/go-bindata/go-bindata/v3/go-bindata@latest
// $ go-bindata -prefix "assets" -fs ./assets/...
// $ go run .
// "physical" files are not used, you can delete the "assets" folder and run the example.
//
// See `file-server/embedding-gzipped-files-into-app` example as well.
//go:embed assets/*
var fs embed.FS
func newApp() *iris.Application {
app := iris.New()
app.Logger().SetLevel("debug")
app.HandleDir("/static", AssetFile())
app.HandleDir("/static", fs)
/*
Or if you need to cache them inside the memory (requires the assets folder