1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-07 20:17:05 +00:00

Implementation of https://github.com/kataras/iris/issues/412 , as requested. Read HISTORY for a code snippet

This commit is contained in:
Gerasimos Maropoulos
2016-09-29 17:05:22 +03:00
parent 4bf1d65877
commit f4b4dd0275
6 changed files with 161 additions and 40 deletions

View File

@@ -2,6 +2,33 @@
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris/iris`.
## 4.4.0 -> 4.4.1
- **NEW**: Template PreRenders, as requested [here](https://github.com/kataras/iris/issues/412).
```go
// ...
iris.UsePreRender(func(ctx *iris.Context, filename string, binding interface{}, options ...map[string]interface{}) bool {
// put the 'Error' binding here, for the shake of the test
if b, isMap := binding.(map[string]interface{}); isMap {
b["Error"] = "error!"
}
// true= continue to the next PreRender
// false= do not continue to the next PreRender
// * but the actual Render will be called at any case *
return true
})
iris.Get("/", func(ctx *Context) {
ctx.Render("hi.html", map[string]interface{}{"Username": "anybody"})
// hi.html: <h1>HI {{.Username}}. Error: {{.Error}}</h1>
})
// ...
```
## 4.3.0 -> 4.4.0
**NOTE**: For normal users this update offers nothing, read that only if you run Iris behind a proxy or balancer like `nginx` or you need to serve using a custom `net.Listener`.