pongo2

package module
v0.0.0-...-4abeea8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

README

echo-pongo2

Middleware echo-pongo2 is a pongo2 template engine support for echo.

Installation
go get github.com/ipfans/echo-pongo2

Example

package main

import (
	"github.com/ipfans/echo-pongo2"
	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
)

func main() {
	serv := echo.New()
	serv.Use(middleware.Logger())
	serv.Use(middleware.Recover())
	serv.Use(pongo2.Pongo2())
	serv.Get("/", func(ctx *echo.Context) error {
		// ctx.Set("ContentType") = "text/html"
		// ctx.Set("encoding") = "UTF-8"
		ctx.Set("template", "index.html")
		ctx.Set("data", map[string]interface{}{
			"user": "ipfans",
		})
		return nil
	})

	serv.Run("127.0.0.1:8080")
}

License

This project is under Apache v2 License. See the LICENSE file for the full license text.

Documentation

Index

Constants

View Source
const (
	ContentType   = "Content-Type"
	ContentLength = "Content-Length"
	ContentBinary = "application/octet-stream"
	ContentHTML   = "text/html"
)

Variables

This section is empty.

Functions

func Pongo2

func Pongo2() echo.MiddlewareFunc

Types

type Options

type Options struct {
	// Directory to load templates. Default is "templates"
	Directory string
}

Options represents a struct for specifying configuration options for the Render middleware.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL