iris/_examples/http_responsewriter/hero
Gerasimos (Makis) Maropoulos 4e15f4ea88 create one generic package for dependency injection which can be used outside of Iris too - worked but unfished
Former-commit-id: a9d600321c07d7c9f39105416f14ae91528a16a3
2017-12-14 23:04:42 +02:00
..
template add a simple hero template example as requested at https://github.com/kataras/iris/issues/840 2017-12-14 06:11:37 +02:00
app.go create one generic package for dependency injection which can be used outside of Iris too - worked but unfished 2017-12-14 23:04:42 +02:00
README.md add a simple hero template example as requested at https://github.com/kataras/iris/issues/840 2017-12-14 06:11:37 +02:00

Hero Template Example

This folder contains the iris version of the original hero's example: https://github.com/shiyanhui/hero/tree/master/examples/app.

Iris is 100% compatible with net/http so you don't have to change anything else except the handler input from the original example.

The only inline handler's changes were:

From:

if _, err := w.Write(buffer.Bytes()); err != nil {
// and
template.UserListToWriter(userList, w)

To:

if _, err := ctx.Write(buffer.Bytes()); err != nil {
// and
template.UserListToWriter(userList, ctx)

So easy.

Read more at: https://github.com/shiyanhui/hero