https://github.com/h3poteto/pongo2echo
Package pongo2echo provides renderer for labstack's echo framework
https://github.com/h3poteto/pongo2echo
echo golang pongo2
Last synced: about 1 month ago
JSON representation
Package pongo2echo provides renderer for labstack's echo framework
- Host: GitHub
- URL: https://github.com/h3poteto/pongo2echo
- Owner: h3poteto
- License: mit
- Created: 2017-10-20T07:58:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-23T21:07:11.000Z (about 2 years ago)
- Last Synced: 2024-10-05T16:41:26.217Z (7 months ago)
- Topics: echo, golang, pongo2
- Language: Go
- Homepage:
- Size: 43 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Pongo2Echo
[](https://github.com/h3poteto/pongo2echo/actions/workflows/build.yml)
[](https://godoc.org/github.com/h3poteto/pongo2echo)
[](https://github.com/h3poteto/pongo2echo/releases)
[](https://dependabot.com)`pongo2echo` provides [pongo2](https://github.com/flosch/pongo2) renderer for [echo](https://github.com/labstack/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.
```go
import (
"github.com/h3poteto/pongo2echo"
"github.com/labstack/echo"
)func main() {
render := pongo2echo.NewRenderer()
render.AddDirectory("server/templates")
e := echo.New()
e.Renderer = rendere.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](https://opensource.org/licenses/MIT).