The Echo framework does provide a facility for custom rendering which is based on the echo.Renderer interface. This interface stipulates that implementations have a method Render which will perform the rendering of data. With this convention, we are able to take what we learned about Go templates and apply those templates to implement a custom echo.Renderer that is capable of rendering HTML templates back to the caller. The following is a very minimal example of an echo.Renderer implementation that we have implemented in $GOPATH/src/github.com/PacktPublishing/Echo-Essentials/chapter8/handlers/reminder.go:
type CustomTemplate struct { *template.Template } func (ct *CustomTemplate) Render(w io.Writer, name string, data interface{}, ctx echo.Context) error { return ct.ExecuteTemplate(w, name, data) }
Within this code block, we are creating...