iris/_examples/view/template_pug_2_embedded/main.go
Gerasimos (Makis) Maropoulos e1f25eb098
Full support of the http.FileSystem on all view engines as requested at #1575
Also, the HandleDir accepts both string and http.FileSystem (interface{}) (like the view's fs)
2020-09-05 08:34:09 +03:00

29 lines
597 B
Go

package main
import "github.com/kataras/iris/v12"
// $ go get -u github.com/go-bindata/go-bindata
// # OR: go get -u github.com/go-bindata/go-bindata/v3/go-bindata
// # to save it to your go.mod file
//
// $ go-bindata -fs -prefix "templates" ./templates/...
// $ go run .
//
// System files are not used, you can optionally delete the folder and run the example now.
func main() {
app := iris.New()
tmpl := iris.Pug(AssetFile(), ".pug")
app.RegisterView(tmpl)
app.Get("/", index)
// http://localhost:8080
app.Listen(":8080")
}
func index(ctx iris.Context) {
ctx.View("index.pug")
}