Router defines a Renderer interface for rendering a template.

  1. func render(ctx *clevergo.Context) error {
  2. return ctx.Render(http.StatusOK, "index.tmpl", map[string]interface{}{
  3. "message": "hello world",
  4. })
  5. }

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.

  1. router.Renderer = jetrenderer.New(jet.NewHTMLSet("./views"))