Open borowiak opened 4 years ago
This works for me.
func (c CoreController) Pages(c *gin.Context) {
var userList = []string{
"Alice",
"Bob",
"Tom",
}
buffer := new(bytes.Buffer)
views.UserList(userList, buffer)
c.Data(c.HttpStatus, "text/html; charset=utf-8", buffer.Bytes())
}
Hi everyone, I wrote code for Hero template system example and I merged it with Gin framework, I didn't see any like this in documentation, I think this can be useful for someone else. I based my code en 2 basic examples. I don't sure where post this, so I opened a issues please feel free to write any suggestion.
@gin-gonic
`package main
import ( "bytes" "fmt" "ginapp/template" "io" "net/http"
"github.com/gin-gonic/gin" )
func main() { router := gin.Default() router.GET("/someDataFromReader", func(c *gin.Context) { var buffer bytes.Buffer var reader io.Reader contentType := "text/html , utf8"
}) router.Run(":8080") } `