Router defines a Renderer
interface for rendering a template.
func render(ctx *clevergo.Context) error {
return ctx.Render(http.StatusOK, "index.tmpl", map[string]interface{}{
"message": "hello world",
})
}
Before starting, we need to register a renderer, supported template engines are listed below.
Please feel free to implement a renderer for other template engine, and then mention it here by creating a PR.
Jet
Jet Renderer is an adapter for Jet template engine.
router.Renderer = jetrenderer.New(jet.NewHTMLSet("./views"))