Skip to content

About

Package pongo2echo provides renderer for labstack's echo framework

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

46 Commits

Folders and files

Repository files navigation

Pongo2Echo

Build GoDoc GitHub release (latest by date) Dependabot

pongo2echo provides pongo2 renderer for echo which is web application framework written by golang. Pongo2 is a template engine likes django-syntax for golang.

This package is useful when you use pongo2 template in echo.

Usage

Setup pongo2echo render when initialize echo.

import (
	"github.com/h3poteto/pongo2echo"
	"github.com/labstack/echo"
)

func main() {
	render := pongo2echo.NewRenderer()
	render.AddDirectory("server/templates")
	e := echo.New()
	e.Renderer = render

	e.GET("/", func(c echo.Context) error {
		// index.html.tpl is located in server/templates/index.html.tpl
		return c.Render(http.StatusOK, "index.html.tpl",  map[string]interface{}{"title": "Index"})
	})
	e.Logger.Fatal(e.Start(":1323"))
}

You can use pongo2 templte in Render function, and pass variables to template.

License

The package is available as open source under the terms of the MIT License.

About

Package pongo2echo provides renderer for labstack's echo framework

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages